On 05/12/12 16:26, jaybytez wrote:
So we modified our code and did the following logic:

Object cookie = loginResponse.getMetadata().getFirst("Set-Cookie");
webClient.header("Cookie", cookie);

So now we get our response from our original login (3rd party invocation),
we get the response and retrieve the first "Set-Cookie", which gives us a
String containing our two cookies.

We then use the header method to add the cookie back to the WebClient
instance before we make our second invocation.

This seems to work with a single request, but when we start to send 11
requests in (as an example), we get our problem again where some requests
succeed, and some requests seem to lose the cookie because our 3rd party
service says we tried the second invocation service without logging in.  So
unless I set the cookie incorrectly, this didn't work for us yet.


I honestly do not think that the client created on the stack can have any thread-related issues.

Can you please configure both loginResponse & webClient instances with LoggingFeature ? In the older CXF it can be done by using JAXRSClientfactoryBean and WebClient factory constructor in the latest CXF, or add LoggingInInterceptor & LoggingOutInterceptor, and start increasing the number of requests 1 by one till you see in the logs that the in or out cookies being lost.

Let us know please what you find...

The totally insane part of this is we are doing two parallel paths, one
solution using WebClient and one with Apache's HttpClient.  WebClient so far
is tripping over itself in a multi-threaded fashion, but Apache's HttpClient
is not (it works with the multiple requests).  But HttpClient fails on the
hostname verification (because WLS has a problem with wildcarded certs), yet
the WebClient's hostname verification works within WLS.  So we are trying to
get both WebClient to work by working with the Cookies, and HttpClient to
work by determining where WLS is invoking it's own classpath and ignoring
Apache's AllowAllHostnameVerifier.

You can use Apache client now with the async support in CXF 2.7.0 -

Sergey





--
View this message in context: 
http://cxf.547215.n5.nabble.com/WebClient-multithreading-within-a-DefaultMessageListenerContainer-tp5719525p5719745.html
Sent from the cxf-user mailing list archive at Nabble.com.


--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to