You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Alexandros Karypidis <ak...@yahoo.gr> on 2009/12/08 15:31:27 UTC

Client endpoints in servlet sessions & clustering

Hi,

I intend to use JAX-WS to access web services from within servlets in a 
clustered environment.

Rather than create a proxy for each servlet invocation, I'd like to 
cache the client stub in the session object.

Does CXF use serializable objects when creating JAX-WS proxies? Is it 
safe to put a JAX-WS client stub in the servlet's "session" object?

Thanks,
Alex

Re: Client endpoints in servlet sessions & clustering

Posted by Daniel Kulp <dk...@apache.org>.
On Tue December 8 2009 9:31:27 am Alexandros Karypidis wrote:
> Hi,
> 
> I intend to use JAX-WS to access web services from within servlets in a
> clustered environment.
> 
> Rather than create a proxy for each servlet invocation, I'd like to
> cache the client stub in the session object.
> 
> Does CXF use serializable objects when creating JAX-WS proxies?

Probably not, no.  Very little in CXF implements serializable so that may end 
up being an issue.    Plus, the clients hold onto things like shared wsdl 
models and JAXBContexts and such that could be huge to serialized

> Is it
> safe to put a JAX-WS client stub in the servlet's "session" object?

You MAY be able to use proxy singletons.   See:
http://cxf.apache.org/faq.html
about the thread safety and such of the proxies.    You could just store and 
special "keys" for the RequestContext into the session and just use a single 
client proxy with a threadsafe RequestContext.  

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog