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.