javax.xml.ws.wsaddressing
@WebService(endpointInterface = "com.example.MyService")
public class MyServiceImpl implements MyService {
@WebMethod
public void myMethod() {
// ...
}
}
// In the client:
MyService service = new MyServiceImpl();
BindingProvider bp = (BindingProvider) service;
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:8080/myService");@WebService(endpointInterface = "com.example.MyService")
public class MyServiceImpl implements MyService {
@WebMethod
public void myMethod() {
// Get the WSA destination from the message context
WSDestination destination = (WSDestination) messageContext.get(MessageContext.WS_ADDRESSING_DESTINATION);
String destinationAddress = destination.getAddress().getValue();
// ...
}
}