Gloria - 

Without looking at both your client and server side configuration, it is
hard to tell exactly where the example went awry.   It seems like you
have not followed the configuration steps for the SimpleSessionHandler.
I didn't post the full example. The e-mail thread assumed that the user
was cognizant of how to initialize the Axis session management
mechanism, and simply wanted to share the session id across services.

An example of how to do the basics is linked to this wiki page:
http://nagoya.apache.org/wiki/apachewiki.cgi?AxisProjectPages/SessionSup
port

Some diagnostic questions for you to review:

Do you have the SimpleSessionHandler deployed at both the server and
client?  
Do you see the session id flowing over the wire by using tcpmon?

/Chris



-----Original Message-----
From: Yan Lin [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 13, 2003 5:07 PM
To: [EMAIL PROTECTED]
Subject: RE: Chris, the example doesn't work, why?

Hi, Chris,

I tried to use the example you gave out and it didn't work.  I always
got NullPointerException
from line "Long oId = getSessionId(oCqServiceLocator);" because there is
no session id ever set.

Do you know what possible caused the problem?

Thanks!

Gloria

------------------------------------------------------------------------
-----------------
Here is the example you gave out:

void CallServices() {

// create the service locator object
CqServiceLocator oServiceLocator = new CqServiceLocator();

// this will globally set all client calls to maintain session state
// NOTE: SimpleSessionHandler must be present in the flows on both the
// client and server
oServiceLocator.setMaintainSession(true);

// CALL Service to Initialize Session ID !!!
oServiceLocator.getCq().callMethod();

// Grab the service session id
Long oId = getSessionId(oCqServiceLocator);

TpServiceLocator oTpServiceLocator = new TpServiceLocator();

// Link the ticketPurchase session to the concertQuery session !!
setSessionId(oTpServiceLocator,oId);

// call Tp methods
}

static public void setSessionId(Service oService, Long oId) {
   AxisEngine engine = oService.getEngine();
   engine.setOption(SimpleSessionHandler.SESSION_ID,oId);
}

static public Long getSessionId(Service oService) {

   AxisEngine engine = oService.getEngine();
   return (Long)engine.getOption(SimpleSessionHandler.SESSION_ID);
}





__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

Reply via email to