简体   繁体   中英

How do I call a NTLM secured webservice using Camel-cxf?

In my Camel (2.13) flow, I want to call a webservice using Camel-CXF. The webservice is secured using NTLM. I did find out thaat CXF itself supports NTLM, but I can't find anything on Camel-CXF. I did try the parameters username and password of course, but that didn't work. Ik looks like Camel-CXF doesn't support it. Any ideas on how to solve this?

I'm using java6 so i don't needs jcifs I think.

Roald

<cxf:cxfEndpoint id="sharepointQueryEndpoint"
                     address="http://yourhostwithpathtowsdl/_vti_bin/search.asmx"
                     serviceClass="com.somewhere.special.generated.QueryServiceSoap" 
                     endpointName="ssp:SecureConnection"
                     xmlns:ssp="http://microsoft.com/webservices/OfficeServer/QueryService"
            >

        <cxf:properties>
            <entry key="dataFormat" value="POJO"/>
            <entry key="loggingFeatureEnabled" value="true" />
        </cxf:properties>
        <cxf:inInterceptors>
            <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
        </cxf:inInterceptors>

        <cxf:outInterceptors>
            <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
        </cxf:outInterceptors>
    </cxf:cxfEndpoint>

    <http:conduit name="{http://microsoft.com/webservices/OfficeServer/QueryService}SecureConnection.http-conduit">
        <http:client
                AllowChunking="false"
                MaxRetransmits="11"
                Connection="Keep-Alive"
                ReceiveTimeout="60000"
                CacheControl="No-Cache"
                />

        <http:authorization>
            <sec:UserName>Domain\Username</sec:UserName>
            <sec:Password>Password</sec:Password>
            <sec:Authorization>NTLM</sec:Authorization>
        </http:authorization>

    </http:conduit>

The attribute serviceClass in the cxfEndpoint configuration is point to the Interface which is generated by wsdl2java. enter code here Note: When this condfiguration is run from a Windows based machine it is not working. During the handshake it will substitute the configured username/password in the http-conduit with the credentials of the user currently logged in. See Can Java's 'single sign-on' (use credentials from 'Credential Manager') on Windows be disabled? for more information

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM