java Camel cxf:cxfEndpoint生成程序错误:找不到操作名为的BindingOperationInfo
我正在使用camel cxf:cxfEndpoint调用一个soap服务,但得到这个BindingOperationInfo错误。配置在我看来是正确的,但不确定哪里做错了
端点配置:
<!-- Soap Client -->
<cxf:cxfEndpoint id="accountEndpoint" address="http://localhost:3333/wspoc/user"
wsdlURL="/wsdl/userSvc.wsdl"
serviceClass="com.cog.poc.acct.HelloWorldImplService"
endpointName="ws:HelloWorldImplPort"
serviceName="ws:HelloWorldImplService"
xmlns:ws="http://acct.poc.cog.com/" loggingFeatureEnabled="true">
<cxf:properties>
<entry key="dataFormat" value="POJO"/>
</cxf:properties>
</cxf:cxfEndpoint>
我的Java DSL路由器配置
from("direct:invokeMyUpdate")
.bean("myAcctSvcClient", "buildSoapReq")
.setHeader(CxfConstants.OPERATION_NAME, constant("getAccountInfo"))
.to("cxf:bean:accountEndpoint")
WSDL元素:
<definitions targetNamespace="http://acct.poc.cog.com/"
name="HelloWorldImplService" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://acct.poc.cog.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<service name="HelloWorldImplService">
<port name="HelloWorldImplPort" binding="tns:HelloWorldImplPortBinding">
<soap:address location="http://localhost:3333/wspoc/user" />
</port>
</service>
<binding name="HelloWorldImplPortBinding" type="tns:HelloWorld">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="rpc" />
<operation name="getHelloWorldAsString">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" namespace="http://acct.poc.cog.com/" />
</input>
<output>
<soap:body use="literal" namespace="http://acct.poc.cog.com/" />
</output>
</operation>
<operation name="getAccountInfo">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" namespace="http://acct.poc.cog.com/" />
</input>
<output>
<soap:body use="literal" namespace="http://acct.poc.cog.com/" />
</output>
</operation>
</binding>
下面是错误:
Stacktrace : java.lang.IllegalArgumentException: Can't find the BindingOperationInfo with operation name {http://acct.poc.cog.com/}getAccountInfo. Please check the message headers of operationName and operationNamespace. at org.apache.camel.component.cxf.CxfProducer.getBindingOperationInfo(CxfProducer.java:379) [camel-cxf-2.16.0.jar:2.16.0] at org.apache.camel.component.cxf.CxfProducer.prepareBindingOperation(CxfProducer.java:211) [camel-cxf-2.16.0.jar:2.16.0] at org.apache.camel.component.cxf.CxfProducer.process(CxfProducer.java:110) [camel-cxf-2.16.0.jar:2.16.0] at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:141) [camel-core-2.16.0.jar:2.16.0]
# 1 楼答案
您是否也尝试设置:
在JAVA DSL中,我想:
我的第二个技巧是运行调试器并将断点放在
CxfProducer.java:379
行上。然后检查CxfProducer.client.conduitSelector.endpoint.binding.bindingInfo.operations
的值我试图解决类似的问题,从wsdl加载的操作集是空的
编辑:我找到了问题的根源,为什么创建的端点的类型是
org.apache.cxf.endpoint.EndpointImpl
而不是org.apache.cxf.jaxws.support.JaxWsEndpointImpl
,并且没有操作信息。以下是一个典型的例子:我错误地将
service.class.name
声明为webservice客户机类,而不是webservice接口类