ServerSocket sock = new ServerSocket(0);
int port = sock.getLocalPort();
Server server = new Server(port);
sock.close();
ResourceHandler reshandler = new ResourceHandler();
reshandler.setResourceBase(getLocation("/wsdl2java_wsdl/"));
// this is the only handler we're supposed to need, so we don't need to
// 'add' it.
server.setHandler(reshandler);
server.start();
env.put(ToolConstants.CFG_WSDLURL, "http://localhost:"
+ port + "/hello_world.wsdl");
env.put(ToolConstants.CFG_BINDING, "http://localhost:"
+ port + "/remote-hello_world_binding.xsd");
processor.setContext(env);
processor.execute();
try {
reshandler.stop();
} finally {
server.stop();
server.destroy();
}