cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arnaud DSA <>
Subject Maintaining session in multi threaded application for Spring jaxws client
Date Fri, 25 Jun 2010 22:47:29 GMT


I used the cxf+spring sample :

And I need to:
- share a the proxy amongst different threads
- maintain sessions for each thread as I need to call three functions in
sequence: login/execute/logout

But I see in the doc
( that
the proxy is not thread safe in this case:
*  Session support - if you turn on sessions support (see jaxws spec), the
session cookie is stored in the conduit. Thus, it would fall into the above
rules on conduit settings and thus be shared across threads.
For the conduit issues, you COULD install a new ConduitSelector that uses a
thread local or similar. That's a bit complex though.
The doc mentions a "complex" solution but I could not fin more information
on this.

I tried to manually handle the cookie by fetching it into a thread local and
putting it back on each request instead of using maintainSession, but I
could not get the session cookie from the client.

My client is loaded from spring like this:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""

    <jaxws:client id="helloClient"
                  address="http://localhost:9002/HelloWorld" />
ApplicationContext context = new
HelloWorld client = (HelloWorld) context.getBean("helloClient");

I can cast the client to a BindingProvider, but I did not find a way to
fetch the session cookie from here:
BindingProvider bp = (BindingProvider) client;

Could someone tell me how to fetch and set the session cookie from the
client, or point me to another solution?

Thanks in advance.
View this message in context:
Sent from the cxf-user mailing list archive at

View raw message