Reputation: 177
I'm using camel 2.16.0
Created a camel route to invoke a web service, dataFormat as MESSAGE and i get the response normally. and this route is invoked using ProducerTemlate
//payloadXml is a string which contains SOAP Request Message.
Object response = producerTemplate.requestBody("direct:invokeWS", payloadXml);
<route id="my_Sample_Camel_Route_with_CXF">
<from uri="direct:invokeWS" />
<to uri="cxf://http://localhost:8111/camel_MQ/TestService?wsdlURL=http://localhost:8111/camel_MQ/TestService?wsdl&serviceName={http://www.test.org/interface/test/ws}camel_MQ-ws&portName={http://www.test.org/interface/test}TestEndpoint&dataFormat=MESSAGE" />
<log message="------------->> ${body}" />
</route>
But once i change the dataFormat to "PAYLOAD"
I get exception.
Caused by: java.lang.IllegalArgumentException: The PayLoad elements cannot fit with the message parts of the BindingOperation. Please check the BindingOperation and PayLoadMessage.
at org.apache.camel.component.cxf.CxfEndpoint$CamelCxfClientImpl.setParameters(CxfEndpoint.java:1171)
Tried creating CxfPayload and then sent that to producerTeamplate while invoking the WS, but still the same Exception,
Upvotes: 0
Views: 3492
Reputation: 177
Finally I'm able to invoke WS using dataFormat as payload. created CxfPayload object and added SOAP Headers and Body to it.
But still i was getting the same exception "The PayLoad elements cannot fit with the message parts of the BindingOperation"
Then I added defaultOperationName & defaultOperationNamespace headers while invoking the webservice as shown below.
<to uri="cxf:bean:camel_MQ_MQ-ws?dataFormat=PAYLOAD&defaultOperationName=TestService&defaultOperationNamespace=http://www.camel_MQ.org/interface&loggingFeatureEnabled=true" />
hope this helps ;-)
Upvotes: 1