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.context", 
"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 );


        }

                                          

Reply via email to