Hi,

 I am using CXF client to connect to Exchange WebService, and I need to support 
multiple users in the runtime.

I did something like this:

….

        JaxWsProxyfactoryBean factory1 = new JaxWsProxyfactoryBean();

        factory1.setServiceClass(exchangeServicePortType.class);

        factory1.setAddress(url);

        exchangeServicePortType exchangeService1 = (exchangeServicePortType) 
factory1

                .create();

        Client proxy = ClientProxy.getClient(exchangeService1);

        HTTPconduit conduit1 = (HTTPconduit) proxy.getconduit();

                ……

        conduit1.getAuthorization().setAuthorizationType("NTLM");

        conduit1.getAuthorization().setUserName(userName1);

        conduit1.getAuthorization().setPassword(password1);

        exchangeService1.getItem(….);

       

       

                   JaxWsProxyfactoryBean factory2 = new JaxWsProxyfactoryBean();

                   factory2.setServiceClass(exchangeServicePortType.class);

                   factory2.setAddress(url);

                   exchangeServicePortType exchangeService2 = 
(exchangeServicePortType) factory2

                                     .create();

                   Client proxy = ClientProxy.getClient(exchangeService2);

                   HTTPconduit conduit2 = (HTTPconduit) proxy.getconduit();

                  

                   ……

                   conduit2.getAuthorization().setAuthorizationType("NTLM");

                   conduit2.getAuthorization().setUserName(userName2);

                   conduit2.getAuthorization().setPassword(password2);

                   exchangeService2.getItem(….);

 

Basically I created 2 services with different username/password, I am expecting 
the CXF client to use different credentials for 2 requests, but I found out 
it’s always using the same credential(userName1/password1), even on 2nd 
request. As I know NTLM is connection based, the CXF will create a new 
HttpURLConnection per request. However HttpURLConnection instances could share 
the underlying network connection.

Much appreciated if there is any workaround to solve my multi-user case.

 

Thanks,

-Roger

Reply via email to