In your generated code (eg: say "HelloWorldWebServiceImplService" ) look in to the static block on the top which will have reference to the WSDL url or wsdl file which is under META-INF.
/*
static {
URL url = null;
try {
url = new URL("http://loclahost/HelloWorld/HelloWorldWebServiceImpl?wsdl");
} catch (MalformedURLException e) {
java.util.logging.Logger.getLogger(HelloWorldWebServiceImplService.class.getName())
.log(java.util.logging.Level.INFO,
"Can not initialize the default wsdl from {0}", "http://loclahost/HelloWorld/HelloWorldWebServiceImpl?wsdl");
}
WSDL_LOCATION = url;
}
*/
Once you comment this you also need to comment out the default construtor and needless to say intialize the static WSDL_LOCATION = null; (to null)
So you will not have two constructors as shown below.
public final static URL WSDL_LOCATION = null;
public HelloWorldWebServiceImplService(URL wsdlLocation) {
super(wsdlLocation, SERVICE);
}
public HelloWorldWebServiceImplService(URL wsdlLocation, QName serviceName) {
super(wsdlLocation, serviceName);
}
Calling Webservice : Now in the client call where you instantiate this object Pass the webservice URL as an argument as shown
//You can read mywebserviceURL from property file as String.
String mywebserviceURL = "http://myqamachine.com/HelloWorld/HelloWorldWebServiceImpl?wsdl"
URL WsURL = new URL(mywebserviceURL);
HelloWorldWebServiceImplService webService = new HelloWorldWebServiceImplService(WsURL);
So here you can point the webservice url dynamically.