axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stadelmann Josef" <>
Subject AW: Build objects at start up
Date Wed, 30 May 2012 17:02:33 GMT
Hi Flavio


guess you know what happens when you past/copy the axis2-1.6.2.war into
a /tomcat/webapps directory? right - axis2-1.6.2 gets deployed (say
installed as a servlet making it known to Tomcat or any Application
Server supporting Axis2. And yes, you can use some of the features by
going to localhost:8080 and look for a management pages where you can
find axis2-1.6.1, Axis2 is a servlet. A larger one.


Then you potentially copy/past an xyz.aar file to the
axis2-1.6.2/WEB-INF/services directory or a jar file or a POJO, each to
its relevant service directory; all called deployment. Axis2 deployes
this services and then Axis2 knows about this services. After that you
can request a service from your registered deployed services.


The problem for you seems to be that your service providing object is
created when a request is sent to this service by a client but that it
takes a longtime to get it ready for each request?



Given the creation takes time, yes, it can be a good idea to request
some init() on the service after the servicer was successfully deployed.
How can you make that your service providing object is not destroyed?
This can be achieved with axis2 by using a notation of
scope="soapsession" in your service.-xml file. See previous posts to
that in this e-mail archive and relevant axis documentation.


In this case, up on receiving a request at that service, a service
object is building up and unless a timeout triggers (axis2.xml) the
object will be retained in memory. Using a ServicegroupID as one of your
soap headers, and a Cooky in your HTML header, as explained in the
documents, such a session will hit your now long lasting previously
established service providing object unless it times out. Where Timeouts
are reset with each request.


The issue you have is the concept of a session. The solution could be:
Your client is an agent which has one major purpose: to launch your time
consuming long lasting service object and to forward received requests
from real clients. So the sole purpose of your agent is 1: to launch the
real long lasting service providing object and 2: to get and forward
request from a number of axis2 clients. That is to say, you have to
implement this agent as an axis2 service itself. It needs only init(),
destroy(), and       OMElement provide(OMElement element) as methods.


Guess the concept of an agent is understood? An agent is serving client
request, and it behaves as a client of the real service providers. Very
much like going to a flight plan search engine which sends then request
in all kind of forms to all kind of flight plan providers and
consolidates this responses into a unique format to be returned to the
real client. In this context an agent has real value.


In this context you can have multiple agents, and each agent will talk
to its own server. Each agent can be created/keept in a certain web
context localhost:8080/Agentservice1/Agent This agent service must run
in scope="soapsession" as well. The /Agentservice/Agent is triggered
once at system startup time to get the time consuming service ready.  


This my thoughts, and yes, we use long lasting sessions since 2006,
since Axis2-1.2, and it works very well. You may call this a state-full
service providing object.





Von: Flavio Palumbo [] 
Gesendet: Mittwoch, 30. Mai 2012 09:22
Betreff: Build objects at start up


Hi all,
I'd like to build some cosuming time object at start up of axis, how can
I do ?
Any hint would be appreciated.

View raw message