0 Replies Latest reply on Aug 5, 2014 10:49 AM by Joseph Alexander

    jax-ws WebServiceContext always null

    Joseph Alexander Newbie

      I am trying to migrate some jax-ws based web services that run in JBoss7.1.1. However, in Wildfly 8.1 my WebServiceContext is always <null>. The following is a small class I've written to isolate a problem I am having. We want the WebServiceContext so that we can record the incoming IP of the request. This is a JDK8/Wildfly8.1 build and deployment.

       

       

      package com.rossgroupinc.memberz.touchpoints.webservice.webprofile;

       

      import javax.annotation.Resource;

       

      import javax.jws.WebMethod;

       

      import javax.jws.WebService;

       

      import javax.servlet.http.HttpServletRequest;

       

      import javax.xml.ws.WebServiceContext;

       

      import javax.xml.ws.handler.MessageContext;

       

      public class WebProfileService {

       

            @Resource

       

            WebServiceContext wsContext;

       

            @WebMethod(operationName="helloWorld")

       

            public void helloWorld(){

       

                 if(wsContext != null){

       

                      MessageContext mc = wsContext.getMessageContext();

       

                      HttpServletRequest request =(HttpServletRequest) mc.get(MessageContext.SERVLET_REQUEST);

       

                      request.getRemoteAddr();

            }

      }


      Any assistance in figuring out what we need to do to get the resource injection working would be appreciated.


      Joe