On the client side, you should be able to get the transport headers from 
the response context.   From there, you could pull the Cookie header out 
and do the cooking processing yourself.    On the second proxy, you 
would set the request headers into the request context.   There wouldn't 
need to be any interceptor involved.

In pseudo code:

port.makeACallToTheService(....);
BindingProvider bp = (BindingProvider)port;
Map<String, List<String>> headers = bp.getResponseContext().
   get("javax.xml.ws.http.response.headers");

...   get the cookie from it .....

bp = (BindingProvider)port2;
Map<String, List<String>> headers = bp.getRequestContext().
   get("javax.xml.ws.http.request.headers");
if (headers == null) {
    headers = new HashMap<String, List<String>>();
    bp.getRequestContext().put("javax......", headers);
}
headers.put("cookie stuff"....);
port2.makeSecondCall(...);


Dan



On Tuesday 18 September 2007, John McLaughlin wrote:
> Hi,
>
>       I've just started to look at CXF, and have successfully managed to
> quickly develop/deploy.
>
>       The scenario I have is that I will have multiple web services running
> in Tomcat, and I want to maintain a session across them. I'm defining
> the services using JAX-WS (newbie here too!)
>
>       I can set BindingProvider.SESSION_MAINTAIN_PROPERTY on the client
> side to true, and this works fine on an individual proxy with
> JSESSIONID sent received, and I can access the appropriate session on
> the server side. However, when I call a second service it results in
> another session being started.
>
>       I've been trawling through APIs and the mail archives all afternoon,
> but haven't come up with any answers. Is it possible to retrieve the
> JSESSIONID from the first service and stuff it into the second
> service? I'm guessing an Interceptor on the client would be the way to
> go, but I haven't been able to find any examples. Failing all that,
> would it be a valid approach to add an Interceptor which would
> add/extract a header on messages?
>
>       I'd prefer to go with the JSESSIONID as I can let Tomcat take care of
> the session management, so if anybody can point me in the right
> direction, I'd much appreciate it!
>
> Thanks,
>
> John



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
[EMAIL PROTECTED]
http://www.dankulp.com/blog

Reply via email to