更新时间:2023-09-11 22:14:46
这是在 JAX-WS的常见问题解答:
Q。如何为请求动态更改Web Service地址?
((BindingProvider)proxy).getRequestContext ).put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,...);
I deployed a JAX-WS Service and use wsimport to generate client code. Because I run wsimport on localhost, I got the client code with binind on "localhost" address.
But I want to reuse those client code on other computers which access my deployed service with a public IP y.y.y.y. How can dynamically use those (once) generated client code to access my service. (The ip of service may change...)
This is covered in the FAQ of JAX-WS:
Q. How can I change the Web Service address dynamically for a request ?
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "...");