I forgot to let you know that it is possible to have access to http request and response using webservice context. Following exmaple show you how to access the client IP address.
package yourpackage;
import javax.annotation.Resource;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.ejb.Stateless;
import javax.servlet.http.HttpServletRequest;
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.handler.MessageContext;
@WebService()
@Stateless()
public class YourWebService {
@Resource
private WebServiceContext wsContext;
/**
* Web service operation
*/
@WebMethod(operationName = "retrieveClientIPAddress")
public String retrieveClientIPAddress() {
HttpServletRequest req = (HttpServletRequest) wsContext.getMessageContext().get(MessageContext.SERVLET_REQUEST);
return req.getRemoteAddr();
}
}
see https://jax-ws.dev.java.net/nonav/2.1.1/docs/api/javax/xml/ws/handler/MessageContext.html
to know other webservice context features.