You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by John Baker <jb...@javasystemsolutions.com> on 2009/06/20 13:07:32 UTC
WS client, headers, and sessions.
Hello,
Can someone point me at an example of session support in CXF? I'm not
configuring with Spring, so some code would be handy. The SOAP server to
which my CXF client connects is using a session cookie and that needs to be
presented across all calls after an initial "login" call.
Also, how does one get the response headers after a call?
Thanks,
John
Re: WS client, headers, and sessions.
Posted by John Baker <jb...@javasystemsolutions.com>.
Hi Daniel,
That's how I solved the problem. I had two connectors and needed to copy the
cookies from one to another. I couldn't help thinking there should be a
better way - perhaps even a set method, as this:
fc.getCookies().putAll(cookiesFromOtherConnector);
is adequate, but not obvious.
I would recommend that session cookies can be set before the call is made via
a setCookies method.
john
On Monday 22 June 2009 20:11:56 you wrote:
> John,
>
> Will this be a single "client proxy" that will be doing all the
> communication with the soap server? If so, it's probably just easier to
> enable the session support on the proxy:
>
> ((BindingProvider)proxy).getRequestContext()
> .put(BindingProvider.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE);
>
> The next option (if you are using a recent version of CXF, if not, please
> upgrade) would be to grab the cookies map directly from the HTTPConduit.
>
> HTTPConduit hc = (HTTPConduit)(c.getConduit());
> Map<String, Cookie> cookies = hc.getCookies()
>
> That can also be easily used to copy session cookies from one proxy object
> to another.
>
> Dan
>
> On Sat June 20 2009 7:07:32 am John Baker wrote:
> > Hello,
> >
> > Can someone point me at an example of session support in CXF? I'm not
> > configuring with Spring, so some code would be handy. The SOAP server to
> > which my CXF client connects is using a session cookie and that needs to
> > be presented across all calls after an initial "login" call.
> >
> > Also, how does one get the response headers after a call?
> >
> > Thanks,
> >
> >
Re: WS client, headers, and sessions.
Posted by Daniel Kulp <dk...@apache.org>.
John,
Will this be a single "client proxy" that will be doing all the communication
with the soap server? If so, it's probably just easier to enable the
session support on the proxy:
((BindingProvider)proxy).getRequestContext()
.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE);
The next option (if you are using a recent version of CXF, if not, please
upgrade) would be to grab the cookies map directly from the HTTPConduit.
HTTPConduit hc = (HTTPConduit)(c.getConduit());
Map<String, Cookie> cookies = hc.getCookies()
That can also be easily used to copy session cookies from one proxy object to
another.
Dan
On Sat June 20 2009 7:07:32 am John Baker wrote:
> Hello,
>
> Can someone point me at an example of session support in CXF? I'm not
> configuring with Spring, so some code would be handy. The SOAP server to
> which my CXF client connects is using a session cookie and that needs to be
> presented across all calls after an initial "login" call.
>
> Also, how does one get the response headers after a call?
>
> Thanks,
>
>
> John
--
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog
Re: WS client, headers, and sessions.
Posted by John Baker <jb...@javasystemsolutions.com>.
Hello,
HTTPClientPolicy.setCookie seems an odd method. It takes one parameter, not
two (i'd expect key/value?), and some other post suggests the format is
value:key (which isn't documented in the API docs). Finally, what do I do if
I want to set multiple cookies?
Could someone clarify this please?
Thanks,
john
On Saturday 20 June 2009 12:07:32 you wrote:
> Hello,
>
> Can someone point me at an example of session support in CXF? I'm not
> configuring with Spring, so some code would be handy. The SOAP server to
> which my CXF client connects is using a session cookie and that needs to be
> presented across all calls after an initial "login" call.
>
> Also, how does one get the response headers after a call?
>
> Thanks,
>
>
> John