Wednesday, January 18, 2017

web service wsdl location

when you create your service, the service class uses the default 'wsdlLocation', which was inserted into it when the class was built from the wsdl. So if you have a service class called SomeService, and you create an instance like this:

SomeService someService = new SomeService();
If you look inside SomeService, you will see that the constructor looks like this:

public SomeService() {
        super(__getWsdlLocation(), SOMESERVICE_QNAME);
}

So if you want it to point to another URL, you just use the constructor that takes a URL argument,
set public SomeService(new URL(wsdlLocation),SOMESERVICE_QNAME)
You are not supposed to change the wsdl file and recompile

Sometimes its ports still attempt to bind to the location set at compile/generation time, setting property for BindingProvider is the last chance.
BindingProvider bp = (BindingProvider)port;
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointURL);

No comments:

Post a Comment