Off course you can change this file with the new WSDL Url but you can also change the endpoint url. IMPORTANT this only works when the original WSDL Url is still accessible. So don't use this.
@WebServiceRef
private static HelloWorldService helloWorldService;
public static void main(String [] args)
{
String newAddress = System.getProperty("wsdlurl");
helloWorldService = new HelloWorldService();
HelloWorld helloWorld = helloWorldService.getHelloWorldPort();
System.out.println("old address "+((BindingProvider)helloWorld).getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY));
((BindingProvider)helloWorld).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY , newAddress);
System.out.println(helloWorld.sayHello());
The other and better way is to use the other proxy client constructor and provide the new WDSL url.
@WebServiceRef
private static HelloWorldService helloWorldService;
public static void main(String [] args)
{
String newAddress = System.getProperty("wsdlurl");
try {
helloWorldService = new HelloWorldService( new URL(newAddress)
, new QName("http://ws.whitehorses.nl/", "HelloWorldService"));
} catch (MalformedURLException e) {
e.printStackTrace();
}
HelloWorld helloWorld = helloWorldService.getHelloWorldPort();
System.out.println(helloWorld.sayHello());
}
The last way ( if you use the jax-ws-client in a web application) is to add a jax-ws-catalog.xml file to the ear deployment of your web application, this will replace the WSDL url at runtime.
the file looks like this. See Gerard Devision blog for more information.
<?xml version="1.0" encoding="ISO-8859-1" ?>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system">
<system systemId="http://localhost:7101/ws_helloworld-Project1-context-root/HelloWorldServicePort?wsdl"
uri="http://localhost:7001/ws_helloworld/HelloWorldServicePort?WSDL"/>
</catalog>



























