Hello:

Has anyone encountered the problem of managing sessions using SOAP header and 
linking the session with HTTP Session? I am prototyping a set of services on 
top of an existing application architecture that uses HTTPSession for state 
management. In the web services that I am writing, we would like to maintain 
session using SOAP header rather than HTTP cookies. Therefore I need to link 
the session id in the SOAP header with the session id of the HttpSession. I 
have written a handler similar to SimpleSessionHandler. This new handler sets 
MessageContext session to use AxisHttpSession. However the linking of 
HttpSession with AxisHttpSession fails. The HttpSession is retrieved, like so:

HttpServletRequest request = (HttpServletRequest) 
context.getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST);
HttpSession httpSession = request.getSession(true);

The getSession method on HttpServletRequest retrieves the session based on a 
cookie or URL but does not accept a "JSESSIONID" to retrieve the session with. 
Therefore the HttpSession is always different than the one we are looking for. 
Has anyone resolved this issue or found a way to get around it? Any help is 
much appreciated.

Rest of the code is something like this:

        AxisHttpSession session = null;
        if (header == null) {
        session = getNewSession(request,httpSession);
      id = session.getRep().getId();             
        }
        // This session is still active...
        (AxisHttpSession) session).touch();
        // Store it away in the MessageContext.
      context.setSession((AxisHttpSession)session);
      context.setProperty(SESSION_ID, id);
      context.setMaintainSession(true);


Many Thanks

-Viraj

Reply via email to