If you want a single instance of your service object for ALL calls (i.e. a singleton), then all you need to do is make sure the "scope" parameter on the service is set to "application" in the engine's WSDD.  In other words, your deploy.wsdd should look like this:
 
<service name="..." provider="java:RPC">
  <parameter name="scope" value="application"/>
  ...
</service>
 
This doesn't care about transport, because the "application session" is always available on the server side.
 
If you really want Sessions (i.e. each client gets their own copy of the service object on the server, and uses that same one for each call), you need two things to happen.  First, you need to set the "scope" parameter to "session" instead of "application".  Second, you need some way of correlating a given client with a particular server-side object instance.  HTTP/servlets automatically deals with this for you by using HTTP cookies.  If you're not using HTTP, but you are using Axis on both sides (client + server), you can use the SimpleSessionHandler (org.apache.axis.handlers.SimpleSessionHandler) to get transport-independent session functionality using SOAP headers.  Just put the SimpleSessionHandler in the request and response flows of your service on BOTH client and server, and everything should work.
 
Hope this helps,
--Glen
 
P.S.  We don't yet have server pre-load of services, but it's a fine idea.  We could preload by default all services with application scope...
-----Original Message-----
From: Ramaswamy Srikant [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 15, 2002 1:11 AM
To: [EMAIL PROTECTED]
Subject: Re: service instances

Looks like this is transport specific(http). Does'nt work for me. I am using Tibco messaging middleware as the transport. Any idea how I can make this work ?

Srikant

Russell Butek wrote:
You're using DII?  Then you have an org.apache.axis.client.Call object:
Call.setMaintainSession(true);

Or if you want to strictly follow JAX-RPC (you have a javax.xml.rpc.Call
object and don't want to cast to org.apache.axis.client.Call):
Call.setProperty("javax.xml.rpc.http.session.maintain", new Boolean(true));

Russell Butek
[EMAIL PROTECTED]


Ramaswamy Srikant <[EMAIL PROTECTED]> on 02/14/2002 11:41:59 AM

Please respond to [EMAIL PROTECTED]

To: [EMAIL PROTECTED]
cc:
Subject: Re: service ins! tances



How do I set this option if I am not using WSDL2Java ?


Srikant

Jean Marc Taillant wrote:

Hi,
Try to use scope="Application" instead of scope="session".
To set this option use -d in WSDL2Java

Hope this help us

Jean Marc

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 14, 2002 3:31 PM
Subject: service instances

Hello,

I've just created and deployed a simple web service using Axis.

Each time I call the web service, a new instance of the class
implementing my web service is created.

Is there any way of controlling this behaviour ? I mean, is it possible
to have one instance per request (current behaviour), or one instance
per
server, a pool of instances ...

My web service needs to access a database. So, I would like to maintain
a persistent connection to the database. I could use a singleton or
a static member but it would take some time when processing the first
request. Is is possible to tell Axis to pre-load some classes when it
starts up to avoid latency with the first request ?

Thank you for your help,

Tom.



Reply via email to