Thank you. I see. So "B" type service are also easy to
implement.

In your answer, doex "second" require "first" ? : Do I
necessarily need to set the scope="session" (have a
dedicated target object for each client) to be able to
use MessageContext.getCurrentContext().getSession()
within my service class ?  

The idea is to have as many session objects as users,
but only one service class intance (thread safe) which
uses the session object to store/retrieve user data.

Thanks in advance,

TD.


--- Glen Daniels <[EMAIL PROTECTED]> wrote:
> 
> Hi Thierry!
> 
> Check out the SimpleSessionTest in test/session. 
> That demonstrates using the SimpleSessionHandler to
> acheive session dynamics with SOAP headers.
> 
> Axis is already all set up to let you use sessions
> in two ways.  First, by specifying the
> scope="session" parameter on your service
> deployment, you can automatically get a new target
> object for each client (the addressbook example does
> this to keep a separate address database per user). 
> Second, you can access an
> org.apache.axis.session.Session object by using
> MessageContext.getSession(), and then use that to
> store custom user data with set() and get().  If you
> want to do this from your target object, you can get
> access to the current MessageContext with the static
> method MessageContext.getCurrentContext().
> 
> So implementing your "B" type services is actually
> pretty easy in Axis, you just need to know what to
> look for.  We support both sessions and
> authentication, and you are welcome to combine them
> in any way you choose, or write new Handlers which
> implement other patterns (and contribute them back
> to Axis, one hopes! :)).
> 
> Hope this helps,
> --Glen
> 
> > -----Original Message-----
> > From: Thierry Dupont [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, February 19, 2002 7:12 AM
> > To: [EMAIL PROTECTED]
> > Subject: RE: How to write a web service which
> updates the servlet
> > session object ?
> > 
> > 
> > OK, I undestand that Axis can manage sessions and
> pass
> > the ID in SOAP headers.
> > 
> > But I don't see from a programmer point of view
> how I
> > can read / write from/to the session.
> > 
> > None of the provided examples saves any user
> > information in the session object.  I don't see
> how
> > they could easily do it, cause Axis does not pass
> to
> > the service any session or message handler.
> > 
> > My idea is to have 2 kinds of services :
> > 
> > A - User independant services, which do not need
> to
> > read/write in any session object. For example
> (stock
> > quotation consultation)
> > 
> > B - User dependant service, here are examples of 2
> > services which require user session management :
> >     1 - an application level authentification
> service,
> > which stores user information (first name, last
> name,
> > bank account number, specific rights) in a session
> > object
> >     2 - an bank statement consultation service
> which
> > gets the bank account number from the user session
> > object
> > 
> > 'A' types services are easy to implement with
> Axis.
> > My feeling for 'B' type services is that it is not
> > trivial with Axis. 
> > 
> > I have the feeling that there is some Axis
> extensions
> > to developp, like extendedRPCprovider or
> > extendedJavaProvider with session management
> > capabilities.
> > 
> > We could imagine that services which want to use
> the
> > Session object are required to implement a
> > SessionAccess interface (setSession, getSession).
> The
> > generic extendedRPCProvider or
> extendedJavaProvider
> > would successively invoke the setSession method,
> then
> > the service methode requested by the client.
> > 
> > I guess there are much nicer solutions from a
> > conceptual point of view.
> > 
> > I don't know if I am being clear.
> > 
> > Apart from getting an answer to this problem, I
> would
> > like to kown if anybody has the same need ? or has
> > another way seeing things.
> > 
> > Thanks in advance,
> > 
> > Thierry.
> > 
> > 
> > 
> > 
> > --- "Adam.Leggett" <[EMAIL PROTECTED]>
> wrote:
> > > You can always use the SOAP Header to maintain
> > > state. Check out
> > > org.apache.axis.handlers.SimpleSessionHandler
> > > 
> > > Cheers
> > > 
> > > Adam
> > > 
> > > -----Original Message-----
> > > From: Thierry Dupont [mailto:[EMAIL PROTECTED]] 
> > > Sent: Monday, February 18, 2002 8:34 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: How to write a web service which
> updates
> > > the servlet session object
> > > ?
> > > 
> > > 
> > > Hello,
> > > 
> > > I find Axis very interesting. 
> > > Amazing how easy it is to publish a web service,
> > > especially stateless service, like getting stock
> > > quotation as show in the example.
> > > 
> > > However, I think that web applications very
> often
> > > have
> > > to handle user session information.
> > > 
> > > Axis can run on top of a servlet engine, and
> most
> > > servlet engines handle efficently sessions
> objects
> > > (fetch, expiration)
> > > 
> > > My question is : how can write an Axis web
> service
> > > which can update the servlet session object ?
> > > 
> > > Does anybody have a sample source code ?
> > > 
> > > Thanks in advance,
> > > 
> > > Thierry.
> > > 
> > > 
> > > 
> > >
> __________________________________________________
> > > Do You Yahoo!?
> > > Yahoo! Sports - Coverage of the 2002 Olympic
> Games
> > http://sports.yahoo.com
> > 
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Sports - Coverage of the 2002 Olympic Games
> > http://sports.yahoo.com
> > 


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com

Reply via email to