You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Sandeep G Nijsure <ni...@mcs.anl.gov> on 2002/10/24 03:21:34 UTC

Session handling

Hi all,

Could someone plz. explain me the diff between session management using 
cookies and SOAP headers? What is the default in Axis? 

I have the following problem:

I am talking to a Axis based web service from inside a Jetspeed portlet
(for our purpose, we can assume it's a servlet). Different users access
the servlet from various machines, and the servlet container maintains
their sessions.  Now I want to maintain sessions between the servlet
container machine and the web service. I am using
stub.setMaintainSession(true), but it's not doing the trick.

The reason is service requests from different users come from the same
machine (the servlet container machine), so that the web service thinks
that it's the same session, even if I am using different stubs for
different users.

Does SOAP header based session management solve this problem? If yes, how 
do I switch to it from Cookie-based?

Thanks in advance 
Sandeep


Re: Session handling

Posted by Ricky Ho <ri...@cisco.com>.
The session is maintain per stub.  Since you create a new stub every time 
(rather than use the previous stub), so you don't have the session behavior.
Since the user browser maintain cookies to the HTTPSession, you should 
store the stub into the HTTPSession variable.

Rgds, Ricky

At 04:04 PM 10/24/2002 -0500, Sandeep G Nijsure wrote:
>Hi Ricky,
>
>Thanx for your response.
>
>I don't know whether I am doing it right, but I create a new
>serviceLocator instance for each user, and get the stub from there.
>
>Does that guarantee that the stub is different each time?
>
>Also, I am not putting the stub manually in HttpSession. Why should I be
>needed to do that?
>
>thanx
>Sandeep
>
>On Thu, 24 Oct 2002, Ricky Ho wrote:
>
> > You are using different stub for different user.  Do you put the each stub
> > in the HttpSession ?  How do you get a particular stub ?
> >
> > Rgds, Ricky
> >
> > At 08:21 PM 10/23/2002 -0500, Sandeep G Nijsure wrote:
> > >Hi all,
> > >
> > >Could someone plz. explain me the diff between session management using
> > >cookies and SOAP headers? What is the default in Axis?
> > >
> > >I have the following problem:
> > >
> > >I am talking to a Axis based web service from inside a Jetspeed portlet
> > >(for our purpose, we can assume it's a servlet). Different users access
> > >the servlet from various machines, and the servlet container maintains
> > >their sessions.  Now I want to maintain sessions between the servlet
> > >container machine and the web service. I am using
> > >stub.setMaintainSession(true), but it's not doing the trick.
> > >
> > >The reason is service requests from different users come from the same
> > >machine (the servlet container machine), so that the web service thinks
> > >that it's the same session, even if I am using different stubs for
> > >different users.
> > >
> > >Does SOAP header based session management solve this problem? If yes, how
> > >do I switch to it from Cookie-based?
> > >
> > >Thanks in advance
> > >Sandeep
> >
> >


Re: Session handling

Posted by Glen Daniels <gd...@macromedia.com>.
Hi Sandeep, Ricky:

The stubs end up caching the HTTP information (i.e. the HTTPTransport object)
per-Service (i.e. org.apache.axis.client.Service).  This means that if you use
the same Locator object to get stubs, they'll all end up sharing the same
session.  If you instead new up a fresh Locator for each client you want to
differentiate, you should get the right behavior.

Hope this helps,
--Glen

----- Original Message -----
From: "Ricky Ho" <ri...@cisco.com>
To: <ax...@xml.apache.org>
Sent: Thursday, October 24, 2002 12:57 PM
Subject: Re: Session handling


> You are using different stub for different user.  Do you put the each stub
> in the HttpSession ?  How do you get a particular stub ?
>
> Rgds, Ricky
>
> At 08:21 PM 10/23/2002 -0500, Sandeep G Nijsure wrote:
> >Hi all,
> >
> >Could someone plz. explain me the diff between session management using
> >cookies and SOAP headers? What is the default in Axis?
> >
> >I have the following problem:
> >
> >I am talking to a Axis based web service from inside a Jetspeed portlet
> >(for our purpose, we can assume it's a servlet). Different users access
> >the servlet from various machines, and the servlet container maintains
> >their sessions.  Now I want to maintain sessions between the servlet
> >container machine and the web service. I am using
> >stub.setMaintainSession(true), but it's not doing the trick.
> >
> >The reason is service requests from different users come from the same
> >machine (the servlet container machine), so that the web service thinks
> >that it's the same session, even if I am using different stubs for
> >different users.
> >
> >Does SOAP header based session management solve this problem? If yes, how
> >do I switch to it from Cookie-based?
> >
> >Thanks in advance
> >Sandeep
>


Re: Session handling

Posted by Sandeep G Nijsure <ni...@mcs.anl.gov>.
Hi Ricky,

Thanx for your response.

I don't know whether I am doing it right, but I create a new
serviceLocator instance for each user, and get the stub from there.

Does that guarantee that the stub is different each time?

Also, I am not putting the stub manually in HttpSession. Why should I be
needed to do that?

thanx
Sandeep

On Thu, 24 Oct 2002, Ricky Ho wrote:

> You are using different stub for different user.  Do you put the each stub 
> in the HttpSession ?  How do you get a particular stub ?
> 
> Rgds, Ricky
> 
> At 08:21 PM 10/23/2002 -0500, Sandeep G Nijsure wrote:
> >Hi all,
> >
> >Could someone plz. explain me the diff between session management using
> >cookies and SOAP headers? What is the default in Axis?
> >
> >I have the following problem:
> >
> >I am talking to a Axis based web service from inside a Jetspeed portlet
> >(for our purpose, we can assume it's a servlet). Different users access
> >the servlet from various machines, and the servlet container maintains
> >their sessions.  Now I want to maintain sessions between the servlet
> >container machine and the web service. I am using
> >stub.setMaintainSession(true), but it's not doing the trick.
> >
> >The reason is service requests from different users come from the same
> >machine (the servlet container machine), so that the web service thinks
> >that it's the same session, even if I am using different stubs for
> >different users.
> >
> >Does SOAP header based session management solve this problem? If yes, how
> >do I switch to it from Cookie-based?
> >
> >Thanks in advance
> >Sandeep
> 
> 



Re: Session handling

Posted by Ricky Ho <ri...@cisco.com>.
You are using different stub for different user.  Do you put the each stub 
in the HttpSession ?  How do you get a particular stub ?

Rgds, Ricky

At 08:21 PM 10/23/2002 -0500, Sandeep G Nijsure wrote:
>Hi all,
>
>Could someone plz. explain me the diff between session management using
>cookies and SOAP headers? What is the default in Axis?
>
>I have the following problem:
>
>I am talking to a Axis based web service from inside a Jetspeed portlet
>(for our purpose, we can assume it's a servlet). Different users access
>the servlet from various machines, and the servlet container maintains
>their sessions.  Now I want to maintain sessions between the servlet
>container machine and the web service. I am using
>stub.setMaintainSession(true), but it's not doing the trick.
>
>The reason is service requests from different users come from the same
>machine (the servlet container machine), so that the web service thinks
>that it's the same session, even if I am using different stubs for
>different users.
>
>Does SOAP header based session management solve this problem? If yes, how
>do I switch to it from Cookie-based?
>
>Thanks in advance
>Sandeep