You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by bharadwaj <bh...@gmail.com> on 2015/01/28 12:10:43 UTC

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

<cxf:cxfEndpoint id="TestService"
		address="${TestServiceServiceUrl}"
endpointName="test:CustomBindingService"
		serviceName="test:OrgService"
		xmlns:crm="http://schemas.microsoft.com/xrm/2011/test/Services"
		wsdlURL="Artifacts/wsdl/testService.wsdl"
		serviceClass="com.microsoft.schemas.xrm._2011.test.services.OrgService">		
		<cxf:properties>
			<entry key="dataFormat" value="PAYLOAD" />
			<entry key="receiveTimeout" value="15000" />
			<entry key="connectionTimeout" value="2000" />
			<entry key="loggingFeatureEnabled" value="true" />
		</cxf:properties>
		<cxf:inInterceptors>
			<ref bean="gzipInterceptor" />
			<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://schemas.microsoft.com/xrm/2011/test/Services}SecureConnection.http-conduit">
        <http:client
                AllowChunking="false"
                MaxRetransmits="11"
                Connection="Keep-Alive"
                ReceiveTimeout="60000"
                CacheControl="No-Cache"
                />

        <http:authorization>
            <sec:UserName>testlabs\\admin</sec:UserName>            
            <sec:Password>test</sec:Password>
            <sec:Authorization>NTLM</sec:Authorization>            
        </http:authorization>

    </http:conduit>

	<camel:routeContext id="TestServiceRoutes">
	    <camel:route>	    	
			<camel:from uri="cxf:bean:mimicTestService?dataFormat=PAYLOAD" />
			
			
			<camel:log logName="Test" loggingLevel="INFO" message="TestService
request recieved ${body}"/>
			
			<camel:removeHeaders pattern="*"/>			
			
			<camel:to uri="cxf:bean:TestService?dataFormat=PAYLOAD"/>
			<camel:log logName="Test" loggingLevel="INFO" message="TestService
response recieved ${body}"/>
		</camel:route> 				
	</camel:routeContext>
	



error 
-----------

	16:30:15,079 | DEBUG | test/Services | SendProcessor                    |
157 - org.apache.camel.camel-core - 2.10.0.redhat-60024 | >>>>
Endpoint[cxf://bean:realDcrmService?dataFormat=PAYLOAD] Exchange[Message:
[com.microsoft.schemas.xrm._2011.test.QueryExpression@58a5fa2e]]
16:30:15,079 | DEBUG | test/Services | CxfProducer                      |
221 - org.apache.camel.camel-cxf - 2.10.0.redhat-60024 | Try to find a
default operation. You should set 'operationName' in header.
16:30:15,081 | DEBUG | test/Services | DefaultErrorHandler              |
157 - org.apache.camel.camel-core - 2.10.0.redhat-60024 | Failed delivery
for (MessageId: ID-M-6QPB102-63418-1422441664194-20-2 on ExchangeId:
ID-M-6QPB102-63418-1422441664194-20-1). On delivery attempt: 0 caught:
org.apache.camel.InvalidPayloadException: No body available of type:
org.apache.camel.component.cxf.CxfPayload but has value:
[com.microsoft.schemas.xrm._2011.contracts.QueryExpression@58a5fa2e] of
type: java.util.ArrayList on: Message:
[com.microsoft.schemas.xrm._2011.contracts.QueryExpression@58a5fa2e]. Caused
by: No type converter available to convert from type: java.util.ArrayList to
the required type: org.apache.camel.component.cxf.CxfPayload with value
[com.microsoft.schemas.xrm._2011.test.QueryExpression@58a5fa2e].
Exchange[Message:
[com.microsoft.schemas.xrm._2011.contracts.QueryExpression@58a5fa2e]].
Caused by: [org.apache.camel.NoTypeConversionAvailableException - No type
converter available to convert from type: java.util.ArrayList to the
required type: org.apache.camel.component.cxf.CxfPayload with value
[com.microsoft.schemas.xrm._2011.test.QueryExpression@58a5fa2e]]


Thanks in Advance!!!



--
View this message in context: http://camel.465427.n5.nabble.com/How-do-I-call-a-NTLM-secured-webservice-using-Camel-cxf-tp5762172.html
Sent from the Camel - Users mailing list archive at Nabble.com.

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

Posted by Anil Vunnava <an...@gmail.com>.
Bharadwaj, You are removing all the headers before sending to endpoint.

Observe the snippet in your code.
<camel:removeHeaders pattern="*"/>

Regards,
Anil Vunnava.

-----Original Message-----
From: "bharadwaj [via Camel]" <ml...@n5.nabble.com>
Sent: ‎28-‎01-‎2015 05:14 PM
To: "Anil Vunnava" <an...@gmail.com>
Subject: Re: How do I call a NTLM secured webservice using Camel-cxf?

Anil, may be in the given code snippet header is missing but we have set the header for operation name.


On Wed, Jan 28, 2015 at 5:05 PM, Anil Vunnava [via Camel] <[hidden email]> wrote:

Hi Bharadwaj,

May I know the web methods (operations) in your web service..?

If there are more than one operations we either need to set header on exchange CxfConstants.OPERATION_NAME.

Regards,
Anil Vunnava


From: [hidden email]
Sent: ‎28-‎01-‎2015 04:40 PM
To: [hidden email]
Subject: How do I call a NTLM secured webservice using Camel-cxf?


<cxf:cxfEndpoint id="TestService" 
                address="${TestServiceServiceUrl}" endpointName="test:CustomBindingService" 
                serviceName="test:OrgService" 
                xmlns:crm="<a href='http://schemas.microsoft.com/xrm/2011/test/Services"' target="_top" rel="nofollow" link="external">http://schemas.microsoft.com/xrm/2011/test/Services"
                wsdlURL="Artifacts/wsdl/testService.wsdl" 
                serviceClass="com.microsoft.schemas.xrm._2011.test.services.OrgService">                
                <cxf:properties>
                        <entry key="dataFormat" value="PAYLOAD" />
                        <entry key="receiveTimeout" value="15000" />
                        <entry key="connectionTimeout" value="2000" />
                        <entry key="loggingFeatureEnabled" value="true" />
                </cxf:properties>
                <cxf:inInterceptors>
                        <ref bean="gzipInterceptor" />
                        <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://schemas.microsoft.com/xrm/2011/test/Services}SecureConnection.http-conduit">
        <http:client 
                AllowChunking="false" 
                MaxRetransmits="11" 
                Connection="Keep-Alive" 
                ReceiveTimeout="60000" 
                CacheControl="No-Cache" 
                />

        <http:authorization>
            <sec:UserName>testlabs\\admin</sec:UserName>            
            <sec:Password>test</sec:Password>
            <sec:Authorization>NTLM</sec:Authorization>            
        </http:authorization>

    </http:conduit>

        <camel:routeContext id="TestServiceRoutes">
            <camel:route>            
                        <camel:from uri="cxf:bean:mimicTestService?dataFormat=PAYLOAD" />
                        
                        
                        <camel:log logName="Test" loggingLevel="INFO" message="TestService request recieved ${body}"/>
                        
                        <camel:removeHeaders pattern="*"/>                        
                        
                        <camel:to uri="cxf:bean:TestService?dataFormat=PAYLOAD"/>
                        <camel:log logName="Test" loggingLevel="INFO" message="TestService response recieved ${body}"/>
                </camel:route>  
        </camel:routeContext>
        



error 
----------- 

        16:30:15,079 | DEBUG | test/Services | SendProcessor                    | 157 - org.apache.camel.camel-core - 2.10.0.redhat-60024 | >>>> Endpoint[cxf://bean:realDcrmService?dataFormat=PAYLOAD] Exchange[Message: [com.microsoft.schemas.xrm._2011.test.QueryExpression@58a5fa2e]] 
16:30:15,079 | DEBUG | test/Services | CxfProducer                      | 221 - org.apache.camel.camel-cxf - 2.10.0.redhat-60024 | Try to find a default operation. You should set 'operationName' in header. 
16:30:15,081 | DEBUG | test/Services | DefaultErrorHandler              | 157 - org.apache.camel.camel-core - 2.10.0.redhat-60024 | Failed delivery for (MessageId: ID-M-6QPB102-63418-1422441664194-20-2 on ExchangeId: ID-M-6QPB102-63418-1422441664194-20-1). On delivery attempt: 0 caught: org.apache.camel.InvalidPayloadException: No body available of type: org.apache.camel.component.cxf.CxfPayload but has value: [com.microsoft.schemas.xrm._2011.contracts.QueryExpression@58a5fa2e] of type: java.util.ArrayList on: Message: [com.microsoft.schemas.xrm._2011.contracts.QueryExpression@58a5fa2e]. Caused by: No type converter available to convert from type: java.util.ArrayList to the required type: org.apache.camel.component.cxf.CxfPayload with value [com.microsoft.schemas.xrm._2011.test.QueryExpression@58a5fa2e]. Exchange[Message: [com.microsoft.schemas.xrm._2011.contracts.QueryExpression@58a5fa2e]]. Caused by: [org.apache.camel.NoTypeConversionAvailableException - No type converter available to convert from type: java.util.ArrayList to the required type: org.apache.camel.component.cxf.CxfPayload with value [com.microsoft.schemas.xrm._2011.test.QueryExpression@58a5fa2e]] 


Thanks in Advance!!! 




If you reply to this email, your message will be added to the discussion below:
http://camel.465427.n5.nabble.com/How-do-I-call-a-NTLM-secured-webservice-using-Camel-cxf-tp5762172.html 
To start a new topic under Camel - Users, email [hidden email] 
To unsubscribe from Camel, click here.
NAML 





If you reply to this email, your message will be added to the discussion below:
http://camel.465427.n5.nabble.com/How-do-I-call-a-NTLM-secured-webservice-using-Camel-cxf-tp5762172p5762177.html 
To unsubscribe from How do I call a NTLM secured webservice using Camel-cxf?, click here.
NAML 







If you reply to this email, your message will be added to the discussion below:
http://camel.465427.n5.nabble.com/How-do-I-call-a-NTLM-secured-webservice-using-Camel-cxf-tp5762172p5762179.html 
To start a new topic under Camel - Users, email ml-node+s465427n465428h32@n5.nabble.com 
To unsubscribe from Camel, click here.
NAML 



--
View this message in context: http://camel.465427.n5.nabble.com/How-do-I-call-a-NTLM-secured-webservice-using-Camel-cxf-tp5762172p5762180.html
Sent from the Camel - Users mailing list archive at Nabble.com.

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

Posted by bharadwaj <bh...@gmail.com>.
Anil, may be in the given code snippet header is missing but we have set
the header for operation name.

On Wed, Jan 28, 2015 at 5:05 PM, Anil Vunnava [via Camel] <
ml-node+s465427n5762177h85@n5.nabble.com> wrote:

> Hi Bharadwaj,
>
> May I know the web methods (operations) in your web service..?
>
> If there are more than one operations we either need to set header on
> exchange CxfConstants.OPERATION_NAME.
>
> Regards,
> Anil Vunnava
> ------------------------------
> From: [hidden email]
> <http:///user/SendEmail.jtp?type=node&node=5762177&i=0>
> Sent: ‎28-‎01-‎2015 04:40 PM
> To: [hidden email] <http:///user/SendEmail.jtp?type=node&node=5762177&i=1>
> Subject: How do I call a NTLM secured webservice using Camel-cxf?
>
> <cxf:cxfEndpoint id="TestService"
>                 address="${TestServiceServiceUrl}"
> endpointName="test:CustomBindingService"
>                 serviceName="test:OrgService"
>                 xmlns:crm="<a href='
> http://schemas.microsoft.com/xrm/2011/test/Services"' target="_top"
> rel="nofollow" link="external">
> http://schemas.microsoft.com/xrm/2011/test/Services"
>                 wsdlURL="Artifacts/wsdl/testService.wsdl"
>
> serviceClass="com.microsoft.schemas.xrm._2011.test.services.OrgService">
>
>                 <cxf:properties>
>                         <entry key="dataFormat" value="PAYLOAD" />
>                         <entry key="receiveTimeout" value="15000" />
>                         <entry key="connectionTimeout" value="2000" />
>                         <entry key="loggingFeatureEnabled" value="true" />
>                 </cxf:properties>
>                 <cxf:inInterceptors>
>                         <ref bean="gzipInterceptor" />
>                         <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://schemas.microsoft.com/xrm/2011/test/Services
> }SecureConnection.http-conduit">
>         <http:client
>                 AllowChunking="false"
>                 MaxRetransmits="11"
>                 Connection="Keep-Alive"
>                 ReceiveTimeout="60000"
>                 CacheControl="No-Cache"
>                 />
>
>         <http:authorization>
>             <sec:UserName>testlabs\\admin</sec:UserName>
>             <sec:Password>test</sec:Password>
>             <sec:Authorization>NTLM</sec:Authorization>
>         </http:authorization>
>
>     </http:conduit>
>
>         <camel:routeContext id="TestServiceRoutes">
>             <camel:route>
>                         <camel:from
> uri="cxf:bean:mimicTestService?dataFormat=PAYLOAD" />
>
>
>                         <camel:log logName="Test" loggingLevel="INFO"
> message="TestService request recieved ${body}"/>
>
>                         <camel:removeHeaders pattern="*"/>
>
>
>                         <camel:to
> uri="cxf:bean:TestService?dataFormat=PAYLOAD"/>
>                         <camel:log logName="Test" loggingLevel="INFO"
> message="TestService response recieved ${body}"/>
>                 </camel:route>
>         </camel:routeContext>
>
>
>
>
> error
> -----------
>
>         16:30:15,079 | DEBUG | test/Services | SendProcessor
>      | 157 - org.apache.camel.camel-core - 2.10.0.redhat-60024 | >>>>
> Endpoint[cxf://bean:realDcrmService?dataFormat=PAYLOAD] Exchange[Message:
> [com.microsoft.schemas.xrm._2011.test.QueryExpression@58a5fa2e]]
> 16:30:15,079 | DEBUG | test/Services | CxfProducer                      |
> 221 - org.apache.camel.camel-cxf - 2.10.0.redhat-60024 | Try to find a
> default operation. You should set 'operationName' in header.
> 16:30:15,081 | DEBUG | test/Services | DefaultErrorHandler              |
> 157 - org.apache.camel.camel-core - 2.10.0.redhat-60024 | Failed delivery
> for (MessageId: ID-M-6QPB102-63418-1422441664194-20-2 on ExchangeId:
> ID-M-6QPB102-63418-1422441664194-20-1). On delivery attempt: 0 caught:
> org.apache.camel.InvalidPayloadException: No body available of type:
> org.apache.camel.component.cxf.CxfPayload but has value:
> [com.microsoft.schemas.xrm._2011.contracts.QueryExpression@58a5fa2e] of
> type: java.util.ArrayList on: Message:
> [com.microsoft.schemas.xrm._2011.contracts.QueryExpression@58a5fa2e].
> Caused by: No type converter available to convert from type:
> java.util.ArrayList to the required type:
> org.apache.camel.component.cxf.CxfPayload with value
> [com.microsoft.schemas.xrm._2011.test.QueryExpression@58a5fa2e].
> Exchange[Message:
> [com.microsoft.schemas.xrm._2011.contracts.QueryExpression@58a5fa2e]].
> Caused by: [org.apache.camel.NoTypeConversionAvailableException - No type
> converter available to convert from type: java.util.ArrayList to the
> required type: org.apache.camel.component.cxf.CxfPayload with value
> [com.microsoft.schemas.xrm._2011.test.QueryExpression@58a5fa2e]]
>
>
> Thanks in Advance!!!
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://camel.465427.n5.nabble.com/How-do-I-call-a-NTLM-secured-webservice-using-Camel-cxf-tp5762172.html
>  To start a new topic under Camel - Users, email [hidden email]
> <http:///user/SendEmail.jtp?type=node&node=5762177&i=2>
> To unsubscribe from Camel, click here.
> NAML
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://camel.465427.n5.nabble.com/How-do-I-call-a-NTLM-secured-webservice-using-Camel-cxf-tp5762172p5762177.html
>  To unsubscribe from How do I call a NTLM secured webservice using
> Camel-cxf?, click here
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5762172&code=YmhhcmFkd2FqMjAxMkBnbWFpbC5jb218NTc2MjE3MnwtMTM0OTYzMDE3MA==>
> .
> NAML
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://camel.465427.n5.nabble.com/How-do-I-call-a-NTLM-secured-webservice-using-Camel-cxf-tp5762172p5762179.html
Sent from the Camel - Users mailing list archive at Nabble.com.

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

Posted by Anil Vunnava <an...@gmail.com>.
Hi Bharadwaj,

May I know the web methods (operations) in your web service..?

If there are more than one operations we either need to set header on exchange CxfConstants.OPERATION_NAME.

Regards,
Anil Vunnava

-----Original Message-----
From: "bharadwaj [via Camel]" <ml...@n5.nabble.com>
Sent: ‎28-‎01-‎2015 04:40 PM
To: "Anil Vunnava" <an...@gmail.com>
Subject: How do I call a NTLM secured webservice using Camel-cxf?

<cxf:cxfEndpoint id="TestService" 
                address="${TestServiceServiceUrl}" endpointName="test:CustomBindingService" 
                serviceName="test:OrgService" 
                xmlns:crm="http://schemas.microsoft.com/xrm/2011/test/Services"
                wsdlURL="Artifacts/wsdl/testService.wsdl" 
                serviceClass="com.microsoft.schemas.xrm._2011.test.services.OrgService">                
                <cxf:properties>
                        <entry key="dataFormat" value="PAYLOAD" />
                        <entry key="receiveTimeout" value="15000" />
                        <entry key="connectionTimeout" value="2000" />
                        <entry key="loggingFeatureEnabled" value="true" />
                </cxf:properties>
                <cxf:inInterceptors>
                        <ref bean="gzipInterceptor" />
                        <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://schemas.microsoft.com/xrm/2011/test/Services}SecureConnection.http-conduit">
        <http:client 
                AllowChunking="false" 
                MaxRetransmits="11" 
                Connection="Keep-Alive" 
                ReceiveTimeout="60000" 
                CacheControl="No-Cache" 
                />

        <http:authorization>
            <sec:UserName>testlabs\\admin</sec:UserName>            
            <sec:Password>test</sec:Password>
            <sec:Authorization>NTLM</sec:Authorization>            
        </http:authorization>

    </http:conduit>

        <camel:routeContext id="TestServiceRoutes">
            <camel:route>            
                        <camel:from uri="cxf:bean:mimicTestService?dataFormat=PAYLOAD" />
                        
                        
                        <camel:log logName="Test" loggingLevel="INFO" message="TestService request recieved ${body}"/>
                        
                        <camel:removeHeaders pattern="*"/>                        
                        
                        <camel:to uri="cxf:bean:TestService?dataFormat=PAYLOAD"/>
                        <camel:log logName="Test" loggingLevel="INFO" message="TestService response recieved ${body}"/>
                </camel:route>  
        </camel:routeContext>
        



error 
----------- 

        16:30:15,079 | DEBUG | test/Services | SendProcessor                    | 157 - org.apache.camel.camel-core - 2.10.0.redhat-60024 | >>>> Endpoint[cxf://bean:realDcrmService?dataFormat=PAYLOAD] Exchange[Message: [com.microsoft.schemas.xrm._2011.test.QueryExpression@58a5fa2e]] 
16:30:15,079 | DEBUG | test/Services | CxfProducer                      | 221 - org.apache.camel.camel-cxf - 2.10.0.redhat-60024 | Try to find a default operation. You should set 'operationName' in header. 
16:30:15,081 | DEBUG | test/Services | DefaultErrorHandler              | 157 - org.apache.camel.camel-core - 2.10.0.redhat-60024 | Failed delivery for (MessageId: ID-M-6QPB102-63418-1422441664194-20-2 on ExchangeId: ID-M-6QPB102-63418-1422441664194-20-1). On delivery attempt: 0 caught: org.apache.camel.InvalidPayloadException: No body available of type: org.apache.camel.component.cxf.CxfPayload but has value: [com.microsoft.schemas.xrm._2011.contracts.QueryExpression@58a5fa2e] of type: java.util.ArrayList on: Message: [com.microsoft.schemas.xrm._2011.contracts.QueryExpression@58a5fa2e]. Caused by: No type converter available to convert from type: java.util.ArrayList to the required type: org.apache.camel.component.cxf.CxfPayload with value [com.microsoft.schemas.xrm._2011.test.QueryExpression@58a5fa2e]. Exchange[Message: [com.microsoft.schemas.xrm._2011.contracts.QueryExpression@58a5fa2e]]. Caused by: [org.apache.camel.NoTypeConversionAvailableException - No type converter available to convert from type: java.util.ArrayList to the required type: org.apache.camel.component.cxf.CxfPayload with value [com.microsoft.schemas.xrm._2011.test.QueryExpression@58a5fa2e]] 


Thanks in Advance!!! 




If you reply to this email, your message will be added to the discussion below:
http://camel.465427.n5.nabble.com/How-do-I-call-a-NTLM-secured-webservice-using-Camel-cxf-tp5762172.html 
To start a new topic under Camel - Users, email ml-node+s465427n465428h32@n5.nabble.com 
To unsubscribe from Camel, click here.
NAML 



--
View this message in context: http://camel.465427.n5.nabble.com/How-do-I-call-a-NTLM-secured-webservice-using-Camel-cxf-tp5762172p5762177.html
Sent from the Camel - Users mailing list archive at Nabble.com.