[jboss-dev-forums] [JBoss Web Services Development] - WebServiceContext

Steve Jagels do-not-reply at jboss.com
Tue Oct 12 17:38:30 EDT 2010


Steve Jagels [http://community.jboss.org/people/sej] created the discussion

"WebServiceContext"

To view the discussion, visit: http://community.jboss.org/message/566143#566143

--------------------------------------------------------------
I'm trying to have a web service store info to a session that is unique for each consumer.

@Resource 
private WebServiceContext wsContext;

@WebMethod
@WebResult(name="MyMethodResponse")
public Integer MyMethod(){

   MessageContext mc = wsContext.getMessageContext();
   HttpSession session = ((javax.servlet.http.HttpServletRequest)mc.get(MessageContext.SERVLET_REQUEST)).getSession();
   Integer count = (Integer) session.getAttribute("count");
   if(null == count){
      count = 0;
      System.out.println("new session id=" + session.getId());
   }
   count++;
   session.setAttribute("count", count);
   return count;
}

The count is supposed to be incremented each time I go through this method, but it does not.

Is there something I need to add to the consumer code for this?  Any other ideas?

I'm using Eclipse 3.4.2, jboss 4.2.3.GA, jdk 1.5.0_17.
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/566143#566143]

Start a new discussion in JBoss Web Services Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2047]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20101012/d44d4dcf/attachment.html 


More information about the jboss-dev-forums mailing list