开发者

maven, wsgen and dynamic url

开发者 https://www.devze.com 2023-01-12 08:46 出处:网络
After implementing a test sol开发者_如何学Pythonution described here : Use Maven to trigger a wsgen & wsimport in a row, using wsdlLocation

After implementing a test sol开发者_如何学Pythonution described here :

Use Maven to trigger a wsgen & wsimport in a row, using wsdlLocation

I wonder if there is a way to generate the client jar without knowing the WS URL, so that it would be usable against any similar ws deployed somewhere else.

Any idea?


I wonder if there is a way to generate the client jar without knowing the WS URL, so that it would be usable against any similar ws deployed somewhere else.

Whatever WSDL URI has been used to generate the JAX-WS client artifacts, you can override a service endpoint address from the client code by using the appropriate constructor:

...
URL newEndpoint = new URL("http://new/endpointaddress?wsdl");
QName serviceName = new QName("http://targetNamespaceURI","EchoService"); 

EchoService service = new EchoService(newEndpoint, serviceName);
Echo port = service.getEchoPort();

System.out.println("Server said: " + echo.echo(args[0]));
...

Related question

  • How to change webservice url endpoint?

See also

  • Changing WSDL url (endpoint) in JAX-WS client
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号