overriding or setting web service endpoint at runtime for code generated with wsimport

Your client can set the end-point in the service “port” at runtime via the BindingProvider interface.

Consider the JAX-WS client in this JAX-WS tutorial. Another way to write this code would be:

HelloService service = new HelloService();
Hello port = service.getHelloPort();
BindingProvider bindingProvider = (BindingProvider) port;
String response = port.sayHello(name);

Caveat: I haven’t downloaded the tutorial code and tested this code against it.

Leave a Comment