— a java class to stop B2B I.S. —
import java.io.*;
import java.util.Vector;
import com.wm.util.Table;
import com.wm.util.Values;
import com.wm.app.b2b.util.GenUtil;
import com.wm.app.b2b.client.Context;
import com.wm.app.b2b.client.ServiceException;
import com.wm.util.coder.ValuesCodable;
public class B2BShutdown {
public static void main(String[] args) {
if (args.length != 3) {
System.out.println("\nUsage: JavaCMD B2BShutdown [yes/no] [force/drain] [timeout]\n");
System.out.println("\t[yes/no] = restart?");
System.out.println("\t[force/drain] = immediate/wait?");
System.out.println("\t[timeout] = minutes to wait before committing?\n");
System.exit(0);
}
// Edit these settings for your locale and then compile
String server = "{your host name}:{port value}";
String username = "Administrator";
String password = "{the admin password}";
// Edit these settings to your preference
String bounce = args[0];
String option = args[1];
String timeout = args[2];
Values in = new Values();
Context context = new Context();
try {
context.connect(server, username, password);
} catch (ServiceException e) {
System.out.println("\n\tCannot connect to server \""+server+"\"");
System.exit(0);
}
try {
in.put("bounce", bounce);
in.put("option", option);
in.put("timeout", timeout);
in = context.invoke("wm.server.admin", "shutdown", in);
} catch (ServiceException e) {
System.out.println("\n\tCould not shutdown server: " + e.getMessage());
System.exit(0);
}
System.out.println(in.getString("message"));
}
}
Cheers,
Emmanuel
#webMethods#webMethods-General#Integration-Server-and-ESB