I have a WSDL file for a web service. I'm using JAX-WS/wsimport to generate a client interface to the web service. I don't know ahead of time the host that the web service will be running on, and I can almost guarantee it won't be http://localhost:8080. How to I specify the host URL at runtime, e.g. from a command-line argument?
The generated constructor MyService(URL wsdlLocation, QName serviceName)
doesn't seem like what I want, but maybe it is? Perhaps one of the variants of Service.getPort(...)
?
Thanks!
Best Answer
The constructor should work fine for your needs, when you create MyService, pass it the url of the WSDL you want i.e. http://someurl:someport/service?wsdl.