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 Günter Ladwig <gl...@gmx.de> on 2004/06/19 22:18:07 UTC

Session timeout? (SimpleSessionHandler)

Hi,

I'm having some problems with SOAP sessions (SimpleSessionHandler). The 
web service I'm trying to develop has an initialize() method which needs 
to be called once before subsequent calls to learnFromURL(). Because of 
this the object needs to be persistent, which is why I decided to use 
sessions. As the client is an Axis client I used SimpleSessionHandler. 
My server-config.wsdd contains this:

  <handler name="session" 
type="java:org.apache.axis.handlers.SimpleSessionHandler" />
  <service name="TextToOntoServer" provider="java:RPC">
   <requestFlow>
    <handler type="session" />
   </requestFlow>
   <responseFlow>
    <handler type="session"/>
   </responseFlow>
   <parameter name="allowedMethods" value="learn,learnFromURL,initialize"/>
   <parameter name="scope" value="session" />
   <parameter name="className" 
value="edu.unika.aifb.ttoServer.TextToOntoServer"/>
  </service>

The client-config.wsdd contains basically the same and in principal the 
session work, but I think the timeout is too short. The first call to 
initialize() takes up to 20 seconds to complete, which doesn't seem to 
be a problem. But learnFromURL() may take up to two minutes or more to 
complete. Here are excerpts from the client-server conversation:

Client calls initialize():
<soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
   <initialize 
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
  </soapenv:Body>

Server response (Session ID included):
[...]
  <soapenv:Header>
   <ns1:sessionID soapenv:mustUnderstand="0" xsi:type="xsd:long" 
xmlns:ns1="http://xml.apache.org/axis/session">5539813838419223788</ns1:sessionID>
  </soapenv:Header>
[...]

Now the client calls learnFromURL() and passes the correct Session ID 
and the server response (about 2 minutes later) still contains the 
correct session ID. But the response to the next call contains a 
different session ID (the client still passed the correct session ID to 
the server):

[...]
  <soapenv:Header>
   <ns1:sessionID soapenv:mustUnderstand="0" xsi:type="xsd:long" 
xmlns:ns1="http://xml.apache.org/axis/session">-7502308238410131107</ns1:sessionID>
  </soapenv:Header>
[...]

It seems to be that during the first call to learnFromURL() Axis loses 
the session, perhaps thinking it is inactive as there has been no 
activity for some time. Therefore it replys with another session ID to 
the second call to learnFromURL().

So, is there a way to avoid this? There are two methods in 
SimpleSessionHandler, which may be useful here: setReapPeriodicity and 
setDefaultSessionTimeout. But how and where do I call these methods? 
Neither the web service nor my client have any session code, I only made 
changes to server-config.wsdd and added a client-config.wsdd.

Thanks in advance.

Günter




Re: Session timeout? (SimpleSessionHandler)

Posted by karim <k....@clipack.com>.
Günter Ladwig wrote:

> Hi!
>
> I didn't get any response to the message below. Is there really no one 
> who knows how to set the timeout? Or is there some other workaround?
>
> Thanks in advance.
>
> Günter
>

Hi,
look at the file web.xml contained in the axis\WEB-INF repository,
there is a tag that allows you to define the session timeout :

    <session-config>
        <!-- Default to 5 minute session timeouts -->
        <session-timeout>5</session-timeout>
    </session-config>

But I'm not sure that it'll solve your problem because you said that the 
session ID is changed in less than 2 minutes.

Karim



Re: Session timeout? (SimpleSessionHandler)

Posted by Günter Ladwig <gl...@gmx.de>.
Hi!

I didn't get any response to the message below. Is there really no one 
who knows how to set the timeout? Or is there some other workaround?

Thanks in advance.

Günter

Günter Ladwig wrote:
> Hi,
> 
> I'm having some problems with SOAP sessions (SimpleSessionHandler). The 
> web service I'm trying to develop has an initialize() method which needs 
> to be called once before subsequent calls to learnFromURL(). Because of 
> this the object needs to be persistent, which is why I decided to use 
> sessions. As the client is an Axis client I used SimpleSessionHandler. 
> My server-config.wsdd contains this:
> 
>  <handler name="session" 
> type="java:org.apache.axis.handlers.SimpleSessionHandler" />
>  <service name="TextToOntoServer" provider="java:RPC">
>   <requestFlow>
>    <handler type="session" />
>   </requestFlow>
>   <responseFlow>
>    <handler type="session"/>
>   </responseFlow>
>   <parameter name="allowedMethods" value="learn,learnFromURL,initialize"/>
>   <parameter name="scope" value="session" />
>   <parameter name="className" 
> value="edu.unika.aifb.ttoServer.TextToOntoServer"/>
>  </service>
> 
> The client-config.wsdd contains basically the same and in principal the 
> session work, but I think the timeout is too short. The first call to 
> initialize() takes up to 20 seconds to complete, which doesn't seem to 
> be a problem. But learnFromURL() may take up to two minutes or more to 
> complete. Here are excerpts from the client-server conversation:
> 
> Client calls initialize():
> <soapenv:Envelope 
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>  <soapenv:Body>
>   <initialize 
> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
>  </soapenv:Body>
> 
> Server response (Session ID included):
> [...]
>  <soapenv:Header>
>   <ns1:sessionID soapenv:mustUnderstand="0" xsi:type="xsd:long" 
> xmlns:ns1="http://xml.apache.org/axis/session">5539813838419223788</ns1:sessionID> 
> 
>  </soapenv:Header>
> [...]
> 
> Now the client calls learnFromURL() and passes the correct Session ID 
> and the server response (about 2 minutes later) still contains the 
> correct session ID. But the response to the next call contains a 
> different session ID (the client still passed the correct session ID to 
> the server):
> 
> [...]
>  <soapenv:Header>
>   <ns1:sessionID soapenv:mustUnderstand="0" xsi:type="xsd:long" 
> xmlns:ns1="http://xml.apache.org/axis/session">-7502308238410131107</ns1:sessionID> 
> 
>  </soapenv:Header>
> [...]
> 
> It seems to be that during the first call to learnFromURL() Axis loses 
> the session, perhaps thinking it is inactive as there has been no 
> activity for some time. Therefore it replys with another session ID to 
> the second call to learnFromURL().
> 
> So, is there a way to avoid this? There are two methods in 
> SimpleSessionHandler, which may be useful here: setReapPeriodicity and 
> setDefaultSessionTimeout. But how and where do I call these methods? 
> Neither the web service nor my client have any session code, I only made 
> changes to server-config.wsdd and added a client-config.wsdd.
> 
> Thanks in advance.
> 
> Günter
> 
> 
>