You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by ja...@external.t-mobile.at on 2008/04/29 16:52:29 UTC

jaxws client proxy questions [Virus checked]

Hello,

could you help me to answer following (soap over http using jaxws+jaxb):

1) is client proxy thread-safe?

2) how is it possible to change address for existing proxy? (want to 
change it multiple times in runtime)

best regards
jano

Re: jaxws client proxy questions [Virus checked]

Posted by Daniel Kulp <dk...@apache.org>.
On Tuesday 29 April 2008, jan.minaroviech@external.t-mobile.at wrote:
> Hello,
>
> could you help me to answer following (soap over http using
> jaxws+jaxb):
>
> 1) is client proxy thread-safe?

By default, no.  This is an issue with the JAX-WS spec as the request 
context is per-proxy so if you use the context for anything, it's not 
thread safe.   If you DON'T use the request context, it is threadsafe.

In CXF, the response context is always thread local, so that is safe.

With 2.0.6 and 2.1, we provide a property that you can set on the proxy 
to change the request context to a thread local.   If you do:

((BindingProvider)proxy).getRequestContext().put(
   "thread.local.request.context", Boolean.TRUE);

Then the NEXT call to getRequestContext() will flip it to a ThreadLocal 
and it would be completely threadsafe except for sessions which are 
always on a per-proxy basis.

> 2) how is it possible to change address for existing proxy? (want to
> change it multiple times in runtime)

((BindingProvider)proxy).getRequestContext().put(
   BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
   url);


-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog