Many times it is useful to access the httpRequest object inside web service code. To manage this you have to do the following
- Declare
@Resource WebServiceContext wsc
- in your web service class
- Then you can access the httpRequest object using the following code
MessageContext mc = wsc.getMessageContext();
HttpServletRequest req = (HttpServletRequest) mc.get(MessageContext.SERVLET_REQUEST);