I will try it.
BTW, is this the best way to deal with cookies on the *server* side?
My concern is it is not portable. Thanks.
@Resource
public void setWebServiceContext(WebServiceContext ctx) {
context = ctx;
}
//Resource
public WebServiceContext getWebServiceContext() {
return context;
}
[...]
{
MessageContext ctx = getWebServiceContext().getMessageContext();
// transport-specific request/response, cxf-specific property
names
HttpServletRequest request = (HttpServletRequest)
ctx.get(AbstractHTTPDestination.HTTP_REQUEST);
HttpServletResponse response = (HttpServletResponse)
ctx.get(AbstractHTTPDestination.HTTP_RESPONSE);
Cookie[] cookies = request.getCookies();
}
-----Original Message-----
From: Daniel Kulp [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 11, 2008 9:24 AM
To: [email protected]
Cc: Wolf, Chris (IT)
Subject: Re: CXF Client not maintaing cookies
Can you try with the 2.0.5 SNAPSHOT?
Due to a bug in 2.0.4, only a single cookie is maintained on the client
side. Thus, if you have mulitple cookies, they won't all be maintained
and sent back. This is fixed with 2.0.5.
The alternitive is to use a session on the server side. The only cookie
going back/forth would be the session cookie and any other state would
be stored in the session. Not ideal.
Dan
On Tuesday 11 March 2008, Wolf, Chris (IT) wrote:
> I am trying to set an HTTP cookie from the CXF server. It works with
> a browser, but the generated CXF client does not keep or send back
> cookies. I tried the code:
>
> SecAdmin_Service ss = new SecAdmin_Service(wsdlURL, SERVICE_NAME);
>SecAdmin port = ss.getSecadmin(); BindingProvider provider =
>(BindingProvider)port;
>provider.getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROP
>ER TY, true);
>
> ...as mentioned here:
> http://www.nabble.com/JSESSIONID-cookie-not-sent-back-to-server-td1551
>40 55.html
>
> but it does not seem to be working. I am using CXF-2.0.4.
>
> Thanks,
>
> -Chris
> --------------------------------------------------------
>
> NOTICE: If received in error, please destroy and notify sender. Sender
> does not intend to waive confidentiality or privilege. Use of this
> email is prohibited when received in error.
--
J. Daniel Kulp
Principal Engineer, IONA
[EMAIL PROTECTED]
http://www.dankulp.com/blog
--------------------------------------------------------
NOTICE: If received in error, please destroy and notify sender. Sender does not
intend to waive confidentiality or privilege. Use of this email is prohibited
when received in error.