9 Replies Latest reply on Oct 3, 2007 4:07 AM by Richard Opalka

    Error getting WebServiceContext/MessageContext information i

    Paul Anderson Newbie

      Below is my web service code:

      package com.company.department.ws;

      import java.rmi.RemoteException;
      import java.util.Map;
      import javax.annotation.Resource;
      import javax.jws.WebMethod;
      import javax.jws.WebService;
      import javax.jws.soap.SOAPBinding;
      import javax.xml.ws.handler.MessageContext;
      import javax.xml.ws.WebServiceContext;

      @WebService(name="TestWebService", targetNamespace="http://www.company.com/department/testwebservice/", serviceName="TestWebService")
      @SOAPBinding(style = SOAPBinding.Style.RPC)
      public class TestWebService {

      @Resource WebServiceContext wsContext;

      public String hello(String name) {
      return "Servlet WS: " + wsContext.getUserPrincipal() + ": " + name;

      When being invoked the exception below is returned:

      16:02:49,552 ERROR [SOAPFaultExceptionHelper] SOAP request exception
      at com.company.department.ws.TestWebService.hello

      The error is happening on the "wsContext.getUserPrincipal()". I feel the the wsContext object is not being set when the service is invoked. I'm at a lost as to what is needed. The end goal of this web service is to pull cookie information from the HTTPRequest object. Please help.