Skip to main content

make JAX-WS work with endpoint changes

2 replies [Last post]
Joined: 2007-07-20

Hi dear fellows!

Sorry for the poor english (i´m brazilian). I´d like to ask a question:

Let´s suppose that I have a Web Service in a Production environment.

I get it´s WSDL and use wsimport to generate artifacts to build a client application.
Ok ´till there, the client works fine and the web service is consumed.

Now let´s say that I have exactly the SAME web service, deployed in another server.

Just explaining, the endpoits point to :

So, as said before, I generated the client for the service at, and it´s being used by several hundreds of aplications that use my client to consume the web service.

So now, let´s suppose that I need, for any reason, start comsuming the service at (it´s the same service, just located elsewhere), abandoning The point is that many people are using the client to access the web service, and I can´t re-generate the artifacts and recompile and rebuild the client and re-distribute it to the people because the endpoit will change.

I know that I can build the client using Dispatch, but that´s not the point.

Do you know how can I dynamically change the endpoint to the web service without need to rebuild the artifacts?!?!

Any help would be appreciated!

Thanks in advance!!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2004-06-01

If you just want to change the endpoint address, you can do it it multiple ways.
When you instantiate the service class, pass the WSDL of the service
like new HelloService(bar.acme.com_wsdl_location,bar.acme.com_service_qname);


Just change the ENDPOINT_ADDRESS_PROPERTY on the proxy.

((BindingProvider) proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,bar.acme.com_service_location)


Joined: 2007-07-20

Orray! TKS for the help... it´s exaclty what I needed.

I did:

SampleService service = new SampleService(new URL(baseUrl, wsdlAddress), SERVICE_QNAME);
Sample servicePort = service.getSampleSoapPort();
String returnedString = servicePort.execute("Test Message");

Tks for the response!

Best regards,