我用的是骆驼2.16.0
创建了一个camel路由来调用web服务,dataFormat作为MESSAGE和我正常地得到响应。使用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>但是一旦我将dataFormat更改为“有效负载”
我有例外。
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)尝试创建CxfPayload,然后在调用WS时将其发送给producerTeamplate,但仍然是相同的异常,
发布于 2015-11-12 05:29:19
最后,我能够使用dataFormat作为有效负载来调用WS。创建了CxfPayload对象,并向其添加了SOAP头和主体。
但我还是得到了同样的例外:“PayLoad元素不能与BindingOperation的消息部分相匹配”
然后,我在调用webservice时添加了defaultOperationName & defaultOperationNamespace头,如下所示。
<to uri="cxf:bean:camel_MQ_MQ-ws?dataFormat=PAYLOAD&defaultOperationName=TestService&defaultOperationNamespace=http://www.camel_MQ.org/interface&loggingFeatureEnabled=true" />希望这有帮助;-)
https://stackoverflow.com/questions/33605423
复制相似问题