I don't think the code Barry sent would get you the sessionID anyway, since 
the Session object that getSession() returns is an 
org.apache.axis.session.Session, which has no method for retrieving a 
sessionID.

You want something like this:

MessageContext msgC = MessageContext.getCurrentContext();
String sessionID = 
msgC.getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST).getSession().getId();

for future reference, the MessageContext is where the Axis developers dump 
most stuff you'd want to get at; it has some specific "get" methods as well 
as the generic getProperty.  HTTPConstants has a list of HTTP Constants 
that are used to refer to various HTTP-specific variables you may want to 
get at.  You might want to take a look at these classes in the API docs; 
they can answer a lot of your questions.

Andrew

At 10:05 AM 7/3/2002 -0700, you wrote:
> > from within a handler, the session can be retieved using :
>
>But how about from within a service?  The interface to my document
>non-rpc service is:
>         public Element[] blah(Vector elems)
>
>All I have is the body of the message at that point.  Anyone know how to 
>access the context?
>
> >
> >   public void invoke(MessageContext msgContext) throws AxisFault
> >   {
> >     Session session = msgContext.getSession();
> >
> > --Barry
> >
> > -----Original Message-----
> > From: Alexander Lyubshav [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, July 02, 2002 11:39 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: confused about cookies
> >
> >
> > Great, that makes it easier!  So, uh, how can I find out the session ID
> > from
> > within the server code?
> >
> >
> > >
> > > >Thanks for your answer.  I am not in control of the client though-- it
> > > >doesn't use the Axis framework either.  Is there an easy way to do this
> > > >without client support?  (Well, of course the client will pass the
> > Cookie
> > > >headers back.)
> > >
> > > I think that's all the Call.setMaintainSession() function does
> > > anyway--tells the client to track the cookie
> > >
> > > > > Alexander,
> > > > >
> > > > > If you want to use cookies for session management, you don't have to
> > add a
> > > > > handler.  You just need to specify session scope in your deploy.wsdd
> > and
> > > > > tell the client to maintain session info.  Check out this message:
> > > > >
> > > > > http://marc.theaimsgroup.com/?l=axis-user&m=101775995930045&w=2
> > > > >
> > > > > which provides a real working sample.
> > > > >
> > > > > Andrew
> > > > >
> > > > > At 08:07 AM 7/2/2002 -0700, you wrote:
> > > > > >I looked in the mailing list archives for information on how to add
> > > > cookie
> > > > > >handling to a web service.  (HTTP Cookies for sessions.  also i'll
> > need
> > > > > >access to the session ID in the program.)
> > > > > >
> > > > > >I was swamped with a big collection of approaches, all of them
> > "well I
> > > > > >haven't done it but this should work" variety.
> > > > > >
> > > > > >What is the common way to do cookie session handling?  Does there
> > already
> > > > > >exist a handler for this?  if so, how can I add taht to my program,
> > and
> > > > > >get access to the session ID from my pivot method?
> > > > > >
> > > > > >Thanks!!
> > > > > >Alexander
> > > > >
> > > > >
> > > > >
> > >
> > >
> > >



Reply via email to