axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Abhinav Maheshwari" <>
Subject Using handlers across different services
Date Sat, 17 Jan 2004 12:14:23 GMT
I am trying to maintain session between two calls on an Axis service. It is
required that the second call should throw an error if the user does not
have a session, i.e. first call is not made.

I tried to use the SimpleSessionHandler shipped with Axis by using the
following xml in the deploy.wsdd file.

<service name="MyService" provider="java:RPC">
    <handler type="session" />
    <handler type="session" />

The problem with this approach is that the SimpleSessionHandler creates a
new session if none exists and does not give an error. So I wrote another
handler SessionValidationHandler derived from SimpleSessionHandler. This
handler takes a parameter "validate" and if this parameter is set to true by

<handler name="sessionValidation"
    <parameter name="SessionHandler.validate" value="true" />

But I cannot set this handler for the entire service since the first call
needs to create a new session if none exists. Is there a way in axis to
deploy different handlers for different calls on the web service ?

I did not know of any such way. So I created two services, one containing
the first method and the another containing the second method. I used the
SessionValidationHandler for the first service with no validation and
SessionValidationHandler for the second service with validation set to true.
This gives a problem because Axis creates two instances of the handlers and
the validating instance of the handler does not contain the sessions set by
the non-validating instance.

So I used a static hashtable to store the activeSessions. This does the job
but does not seem like a good solution. Is there a better way to do it ?
If anyone has encountered the need for using validation for sessions, I can
also post the code.
Thanks and regards,

View raw message