users@jax-ws.java.net

Re: How can you change the endpoint programmatically?

From: Vivek Pandey <Vivek.Pandey_at_Sun.COM>
Date: Tue, 20 Feb 2007 09:29:15 -0800

You can try setting ENDPOINT_ADDRESS_PROPERTY on the RequestContext. For
example:

((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
"http://localhost:8080/anotherendpointaddress");

-vivek.
Maverick Merritt wrote:
>
> Hello,
>
> How can I change the endpoint programmatically? For example, I am
> writing a command line application in
> Java that needs to talk to a Web Service using Netbeans IDE. I create
> client stubs using wsimport pointing
> to the WSDL file from the server that is provided by the Web Service.
>
> The folks that provide the Web Service actually provide two Web
> Services that have the same exact Interface,
> one for testing and another for production. I want to point to either
> one. I don't want to have to create
> two sets of client stubs, for each WSDL. I want to create a single
> copy of the client stubs and just change the
> endpoint via the command line. Also, I would like to do some
> interoperability tests using the WSI
> interoperability tools. These tools act as a man in the middle where
> you direct the client to use the
> host and port of the WSI monitor service.
>
> With JAX-WS, It seems that it "embeds" the endpoint (taken from the
> WSDL file) down in the generated client
> stubs. This is fine if I always want to talk to that single server
> for the rest of the application's life. What if they
> moved? They provide the same API, so why recreate the client stubs
> again? What if you wanted to do load
> balancing?
>
> I cannot find a simple or reasonable way to programmatically change
> the endpoint. Can anyone please help?
>
> Sincerely,
> Maverick Merritt
>