What version of Axis are you using? I don't have a getEngine() method
on the service and the one on the locator throws an NPE when I
AxisEngine e = locator.getEngine();
Long id = (Long)e.getOption(SimpleSessionHandler.SESSION_ID);
System.out.println(">>>> " + id);
I always get null (the return from getOption is what is null, e is a
valid engine instance) even though I can clearly see the ID in the SOAP:
<ns1:sessionID soapenv:mustUnderstand="0" xsi:type="xsd:long"
xmlns:ns1="http://xml.apache.org/axis/session">-795906873738435950</ns1:sessionID>
Odd - not sure why the ID isn't getting set in my options.
On Mon, 2004-04-26 at 02:55, Dorner Thomas wrote:
> Ok, that is what we do,
> You can place this in your Axis-Client and call the Methods to set and get
> your session!
>
>
> /*************************************************************************
> * This method sets the SessionId for the next call. It use the
> * SimpleSessionHandler for this challenge.
> *
> * @param myService - Is the Service we use (Locator).
> * @param myId - SessionID
>
> ************************************************************************/
> static public void setSessionId(Service myService, Long myId) {
>
> AxisEngine engine = myService.getEngine();
> engine.setOption(SimpleSessionHandler.SESSION_ID, myId);
> }
>
>
>
> /*************************************************************************
> * This method gets the SessionId from the SimpleSessionHandler.
> *
> * @param myService - Is the Service we use (Locator).
> *
> * @return sesssionId
>
> ************************************************************************/
> static public Long getSessionId(Service myService) throws
> AxisFault {
>
> AxisEngine engine = myService.getEngine();
> return
> (Long)engine.getOption(SimpleSessionHandler.SESSION_ID);
> }
>
>
> Tomi
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Ryan Stutsman [mailto:[EMAIL PROTECTED]
> Gesendet: Freitag, 23. April 2004 23:58
> An: [EMAIL PROTECTED]
> Betreff: RE: Sessions across several services with Client
>
>
> What you describe is exactly what I have done; however, what I'm asking
> is...
>
> How do I then, take that sessionID in response from the login method of
> one service and put it into the request header of say getPerson from the
> person service.
>
> I can't for the life of me figure out how to 1) get the sessionID from
> the header on the Axis client and 2) get the sessionID back into the
> Axis client's request header.
>
> I did this in PHP with a nuSOAP client easily because it has a method
> for getting and setting header tags.
>
> On Fri, 2004-04-23 at 16:52, Yakulis, Ross (Ross) wrote:
> > I am not sure I fully follow your question:
> > "but how do I do this with the Axis client".
> > Specifically how are you differentiating "axis client"
> > from other clients?
> >
> > I have done something similar use SOAP headers to pass a session from
> > on axis web service to another. The first web service logs
> > on and creates the session token that is returned in the
> > SOAPHeader, then that token is propagated to other services. I did
> > not use the java sessions and did my own session control on the server
> side.
> >
> > Ross
> >
> > -----Original Message-----
> > From: Ryan Stutsman [mailto:[EMAIL PROTECTED]
> > Sent: Friday, April 23, 2004 2:48 PM
> > To: [EMAIL PROTECTED]
> > Subject: Sessions across several services with Client
> >
> >
> > Hello,
> >
> > I have an Axis app server which has several web services. They all
> > share a common session (using the SimpleSessionHandler with the
> > sessionID in the SOAP headers right now). e.g. You start a session on
> > the user service it'll follow you to the person service, etc, etc.
> >
> > Now, I've gotten a few clients to work with this fine, but how do I do
> > this with the Axis client?
> >
> > I can't seem to figure out how to SET the sessionID in the request
> > header. I want to override the automatic sessionID with the ID that I
> > have from the other service.
> >
> > Since there's no MessageContext and locator.getEngine() returns null I'm
> > not sure how to attack it.
> >
> > Thanks.