Hi all,

I have the following problem with CXF(2.2.5) and Spring (2.5.6):

The setup is

    <bean id="serviceWrapper" class="wrapperClass">
                <constructor-arg ref="cxf.service"/>
                <property name="address"><value>xxxx</value></property>
        </bean>
    <jaxws:client id="cxf.service"
                  serviceClass="serviceClass"/>

in the constructor of the wrapper class i set

                BindingProvider bp = (BindingProvider) service;
                bp.getRequestContext().put("thread.local.request.context", 
Boolean.TRUE); 

(also tried with bp.getRequestContext().put("thread.local.request.context",
"true");  as stated in FAQ)

the address is set like this (and this works):

                BindingProvider bp = (BindingProvider) service;
                
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 
                  address);

before each request to the service i set the threadlocal
(Boolean.TRUE/"true) and the headers

bp.getRequestContext().put("thread.local.request.context", Boolean.TRUE); 
List<Header> headers = new ArrayList<Header>();
Header myHeader = new Header(new QName(MY_NS,   MY_LOC_N), "test123",
                                                new 
JAXBDataBinding(String.class));
headers.add(myHeader);

The header setting, the call all works. But when i do more threads, when
doing junit tests on this client
with more testclasses using the client class. The headers stay as set in the
first time.

In the testclasses i inject the wrapper like this:

@Resource
public ServiceWrapper serviceWrapper;

When i set the scope of the wrapper to prototype then all the tests pass.
The headers are not hold in
the wrapper but occur in the outgoing message (if not set to prototype).
So CXF holds them anywhere. So what is wrong with the setup?

Regards,
ggsoft
-- 
View this message in context: 
http://old.nabble.com/Spring-CXF-Client-Header-not-threadsafe--tp28032062p28032062.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to