You can use javax.xml.ws.Endpoint
, here is an example
@WebServiceProvider
@ServiceMode(Mode.MESSAGE)
public class SOAPServer implements Provider<SOAPMessage> {
public SOAPMessage invoke(SOAPMessage request) {
... process request and create response
return response;
}
public static void main(String[] args) throws Exception {
Endpoint.publish("http://localhost:1111/test", new SOAPServer());
}
}
send a request
...
URL endpoint = new URL("http://localhost:1111/test");
SOAPMessage response = connection.call(message, endpoint);
...