cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrei Shakirin <ashaki...@talend.com>
Subject RE: multiple WS calls to the same URL as different user from same VM
Date Sun, 17 Nov 2013 16:29:17 GMT
Hi,

I think the conduit settings are not thread safe even if you use ((BindingProvider)port).getRequestContext().put("thread.local.request.context",
"true").
See http://cxf.apache.org/faq.html#FAQ-AreJAXWSclientproxiesthreadsafe%3F for details.
Could you try to create client proxy object per thread?

Regards,
Andrei.

> -----Original Message-----
> From: Samo Dadela [mailto:samo_dadela@hotmail.com]
> Sent: Freitag, 15. November 2013 13:44
> To: users@cxf.apache.org
> Subject: RE: multiple WS calls to the same URL as different user from same
> VM
> 
> Hi,
> 
> This is the latest code. NTLM now works, but I'm getting "Authorization loop
> detected on Conduit" once and "Buffer already closed for writing" every now
> and then... It seems something is not thread-safe. I'm also not sure if I'm
> using a single conduit or is it being shared.
> 
> This code is running in 7 threads as 7 different users:
> 1. proxy is created and configured
> 2. call made
> 3. repeats 1
> 
>         Lists ss = null;
>         ListsSoap port = null;
> 
> 
>         ss = new Lists(wsdlURL, serviceName);
>         port = ss.getListsSoap();
> 
> 
> ((BindingProvider)port).getRequestContext().put("thread.local.request.cont
> ext", "true");
> 
>         // See:
>         // http://monkeyingwithjava.wordpress.com/2012/09/27/connecting-to-
> microsoft-dynamics-crm-4-0-webservices-with-java-lessons-learned/
>         Bus bus = BusFactory.getDefaultBus();
>         bus.setProperty("use.async.http.conduit", "true" );
>         bus.setProperty("thread.local.request.context", "true");
> 
>         Client client = ClientProxy.getClient( port );
>         HTTPConduit http = (HTTPConduit)client.getConduit();
>         if ( http instanceof AsyncHTTPConduit ) {
>             AsyncHTTPConduit conduit = (AsyncHTTPConduit)http;
>             DefaultHttpAsyncClient defaultHttpAsyncClient;
>             try {
>                 defaultHttpAsyncClient = conduit.getHttpAsyncClient();
>             }
>             catch ( IOException exception ) {
>                 throw new RuntimeException( exception );
>             }
> 
>             defaultHttpAsyncClient.getCredentialsProvider().setCredentials(
> AuthScope.ANY,
>                     new NTCredentials( username, password, "", domain ) );
> 
>             conduit.getClient().setAllowChunking( false );
>             conduit.getClient().setAutoRedirect( true );
> 
> 
>         }
> 
> 

Mime
View raw message