WillamS
WillamS

Reputation: 2517

jax-ws generated webservice client change service endpoint at runtime

How can I change the webservice endpoint URL of a webservice client generated by the netbeans wizard (webservice client from wdsl URL ).

I tried to change the webservice endpoint by both methods given in this question Change WebService endpoint address at run time .

Somehow both methods don't work in my situation. The webservice endpoint stays the same even if I give an URL with a non existing or empty host name in it. It still refers to my testing webservice running on the glassfish server in netbeans, and succesfully loads data from the webservice.

I tried to clean and rebuild all the involved code to make sure that there is no mistake there. I tried to use the debugger to make sure that the endpoint URL is changed for the webservice, but I can't seem to find where this variable is located in service or port class.

Who has an idea of what is going wrong?

Upvotes: 2

Views: 3550

Answers (2)

Rafael
Rafael

Reputation: 11

Check that you are providing a correct ENDPOINT_ADDRESS_PROPERTY and not the WSDL URL.

Upvotes: 1

WillamS
WillamS

Reputation: 2517

One of the solutions given in the mentioned question is now working for me. I don't know what I changed to make this work.

BindingProvider bp = (BindingProvider) port;
    bp.getRequestContext().put(
            BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
            "http://" + ip + ":8080/myWebservice/myWebservice?wsdl");

Upvotes: 1

Related Questions