Hi Andrei, 

I also tried the HtttpAsynClient by adding:
((BindingProvider)port).getRequestContext().put("thread.local.request.context", 
"true");
((BindingProvider)port).getRequestContext().put("use.async.http.conduit", 
Boolean.TRUE);

but I get:
org.apache.http.client.NonRepeatableRequestException: Cannot retry request with 
a non-repeatable request entity.

Any idea?

I also noticed that in the lib dir there is a httpclient-4.2.5.jar. Is this 
HttpClient 4? 
If so, is there a way to use my own HttpClient 4? Is it possible to replace it? 
How can I pass an instance of (a modified) HttpClient to CXF? 

I'm also a bit baffled as to why it is so difficult to do call webservices from 
different threads as different users? Am I the only one that needs that? Is 
there another way to achieve the same effect without doing the calls in 
sequence?

Best regards, 

Samo

> From: [email protected]
> To: [email protected]
> CC: [email protected]
> Subject: RE: multiple WS calls to the same URL as different user from same VM
> Date: Sat, 9 Nov 2013 19:39:57 +0000
> 
> Hi,
> 
> You can take a look into NTLM with HttpAsyncClient 
> https://cwiki.apache.org/confluence/display/CXF20DOC/Asynchronous+Client+HTTP+Transport.
> I am not absolutely sure that you can share the same client proxy with 
> different threads by using this code:
> 
> (BindingProvider)proxy).getRequestContext().put("thread.local.request.context",
>  "true")
> ...
> Credentials creds = new NTCredentials("username", "pswd", null, "domain");
> bp.getRequestContext().put(Credentials.class.getName(), creds);
> // make client proxy call
> 
> If it doesn't work, perhaps the solution is to create client proxy per thread.
> 
> Regards,
> Andrei.
> 
> > -----Original Message-----
> > From: Samo Dadela [mailto:[email protected]]
> > Sent: Freitag, 8. November 2013 15:57
> > To: [email protected]
> > Subject: multiple WS calls to the same URL as different user from same VM
> > 
> > Hi,
> > 
> > Searched long and wide but can't find anything on the issue... Using JDK 6.
> > 
> > I've generated a JAX-WS client proxy using wsdl2java using Lists.wdsl
> > (SharePoint). I can authenticate via NTLM without problem by passing the
> > credentials via java.net.Auhtenticator (setDefault)...
> > 
> > What I want to do is to call the same webservice method from different
> > threads (concurrently) but each call has to be authenticated as a different
> > user. How can this be done? I don't know how to specify different
> > credentials for each call.
> > 
> > A code example would be appreciated.
> > 
> > Best regards,
> > 
> > Samo
> > 
> > 
                                          

Reply via email to