You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Hugo Terelle <te...@acic.biz> on 2012/02/08 09:42:23 UTC

Camel routing with HTTP and NTLM

Hi,

I have a problem concerning a routing in camel.

I have a webservice client using CXF which connects to a webservice 
protected by a Windows server (NTLM authentication). When I connect with 
my CXF client using this code in Java everything goes fine:

             Authenticator.setDefault(new AppliAuthenticator());
             Client client = ClientProxy.getClient(port);
             HTTPConduit http = (HTTPConduit) client.getConduit();
             HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
             httpClientPolicy.setConnectionTimeout(40000);
             httpClientPolicy.setAllowChunking(false);
             http.setClient(httpClientPolicy);

...

public class AppliAuthenticator extends Authenticator {

     private final static String NTLM_DOMAIN = "xxx";
     private final static String NTLM_SEPARATOR = "\\";
     private final static String NTLM_USER = "xxx";
     private final static String NTLM_PASSWORD = "xxx";

     @Override
     public PasswordAuthentication getPasswordAuthentication() {
         return new PasswordAuthentication(NTLM_DOMAIN + NTLM_SEPARATOR 
+ NTLM_USER, NTLM_PASSWORD.toCharArray());
     }
}


But my WSDL file is pointing to the external webservice.  I want to put 
the address of my external webservice in my camel configuration (with a 
route to an external server)

But when I want to use a camel route in servicemix instead of this java 
code, the NTLM authentication doesn't work anymore:

In my spring xml file:


<cxf:cxfEndpoint id="mipCorporateWebServiceProxy"
         address="http://localhost:8082/ServerAPI/servercommandservice.asmx"
         wsdlURL="wsdl/serverapi-servercommandservice.wsdl"/>


<route>
<from uri="cxf:bean:mipCorporateWebServiceProxy?dataFormat=MESSAGE"/>
<to 
uri="http://192.168.20.70/ServerAPI/servercommandservice.asmx?authMethod=NTLM&amp;authUsername=xxx&amp;authPassword=xxx&amp;authDomain=xxx;"/>
</route>


The ntlm authentication fails telling that my credential information are 
wrong... (but in wireshark, the negociation is done) ... BUT my 
credentials are ok (no typo error, etc)


Help, help!


Thank you
Hugo Terelle

















Re: Camel routing with HTTP and NTLM

Posted by Hugo Terelle <te...@acic.biz>.
I forgot to tell that everything is running under Servicemix 4.3.0



On 02/08/2012 09:42 AM, Hugo Terelle wrote:
> Hi,
>
> I have a problem concerning a routing in camel.
>
> I have a webservice client using CXF which connects to a webservice 
> protected by a Windows server (NTLM authentication). When I connect 
> with my CXF client using this code in Java everything goes fine:
>
>             Authenticator.setDefault(new AppliAuthenticator());
>             Client client = ClientProxy.getClient(port);
>             HTTPConduit http = (HTTPConduit) client.getConduit();
>             HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
>             httpClientPolicy.setConnectionTimeout(40000);
>             httpClientPolicy.setAllowChunking(false);
>             http.setClient(httpClientPolicy);
>
> ...
>
> public class AppliAuthenticator extends Authenticator {
>
>     private final static String NTLM_DOMAIN = "xxx";
>     private final static String NTLM_SEPARATOR = "\\";
>     private final static String NTLM_USER = "xxx";
>     private final static String NTLM_PASSWORD = "xxx";
>
>     @Override
>     public PasswordAuthentication getPasswordAuthentication() {
>         return new PasswordAuthentication(NTLM_DOMAIN + NTLM_SEPARATOR 
> + NTLM_USER, NTLM_PASSWORD.toCharArray());
>     }
> }
>
>
> But my WSDL file is pointing to the external webservice.  I want to 
> put the address of my external webservice in my camel configuration 
> (with a route to an external server)
>
> But when I want to use a camel route in servicemix instead of this 
> java code, the NTLM authentication doesn't work anymore:
>
> In my spring xml file:
>
>
> <cxf:cxfEndpoint id="mipCorporateWebServiceProxy"
>         
> address="http://localhost:8082/ServerAPI/servercommandservice.asmx"
>         wsdlURL="wsdl/serverapi-servercommandservice.wsdl"/>
>
>
> <route>
> <from uri="cxf:bean:mipCorporateWebServiceProxy?dataFormat=MESSAGE"/>
> <to 
> uri="http://192.168.20.70/ServerAPI/servercommandservice.asmx?authMethod=NTLM&amp;authUsername=xxx&amp;authPassword=xxx&amp;authDomain=xxx;"/>
> </route>
>
>
> The ntlm authentication fails telling that my credential information 
> are wrong... (but in wireshark, the negociation is done) ... BUT my 
> credentials are ok (no typo error, etc)
>
>
> Help, help!
>
>
> Thank you
> Hugo Terelle
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>