If it is run time data I would suggest to store in ConfigurationContext
(if there are not belong to the same servie group), if they belong to
the same service group then you can store in the service group context.

If you deploy the service in transport session you will get access to
the HTTP session related info, and you can access them using message
context.

Thanks,
Deepal

Isuru Suriarachchi wrote:
> Hi,
>
> If you want to share data between web services, the best way is to use
> the Axis Configuration. You can access the Axis config through Message
> context. So Add your data object into Axis Config as follows.
>
> MessageContext mc = MessageContext.getCurrentMessageContext();
> mc.getConfigurationContext().getAxisConfiguration().addParameter(name,
> object);
>
> To retrieve it from any other web service,
>
> mc.getConfigurationContext().getAxisConfiguration().getParameter(name);
>
> Thanks,
> ~Isuru
>
> On Sun, Sep 6, 2009 at 8:21 AM, Ramya K Grama <[email protected]
> <mailto:[email protected]>> wrote:
>
>     Hello:
>     Is there a way to access the HTTPSession object from the Axis2 web
>     service - either in the MessageReceiverInOut/Skeleton OR is there a
>     way to share data between webservices using OperationContext
>     somehow???
>
>     Here is some background info behind my question:
>     In our group of web services, there is a need for the web services to
>     have access to look up data that resides in the database.
>     My first approach to making this possible is:
>      1: to have a CacheService that reads the lookup data from the DB and
>     saves it in OperationContext somehow (I need to figure out the details
>     of how this can be done).
>      2: All other web services should be able to get hold of this java
>     object from the OperationContext.
>      3: Since the lookup data can change, the CacheService needs to be
>     triggered, say every 15mins or so, by a ServletContext Listener that
>     will be configured to load on Tomcat startup, and sleep for 15mins or
>     so and re-trigger the request to the CacheService to get the fresh
>     data from DB and refresh the cache.
>     Challenge in this approach: Other web services accessing the data from
>     the OperationContext - not sure if this is possible????
>
>     Second approach:
>     1. Have a ServletContext listner, configured to load on server
>     startup, do the DB access to get the lookup data and store the data in
>     HTTPSession.
>     2. Have other web services access the HTTPSession object somehow (not
>     sure how???) and voila! problem solved!
>     Challenge in this approach: Not sure if a web service can have access
>     to a HTTPSession object of the "axis2" web application. If so how????
>
>     Has anybody else come across a similar issue, if so what has been your
>     approach, has it been different than the two approaches I have in
>     mind.
>     If so what are they? If not, any ideas on how I could resolve the 2
>     challenges in my 2 approaches?
>     Your timely help is highly appreciated!!!
>
>     Thanks!
>     wsNewbie
>
>
>
>
> -- 
> Senior Software Engineer,
> WSO2 Inc. http://wso2.org/
> Blog : http://isurues.wordpress.com/

-- 
Thank you!


http://blogs.deepal.org
http://deepal.org

Reply via email to