Many times it is useful to access the httpRequest object inside web service code. To manage this you have to do the following

  1. Declare
    @Resource WebServiceContext wsc
  2. in your web service class
  3. Then you can access the httpRequest object using the following code
    MessageContext mc = wsc.getMessageContext();
    HttpServletRequest req = (HttpServletRequest) mc.get(MessageContext.SERVLET_REQUEST);

By admin