我使用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>
以下是错误:
堆栈跟踪 :java.lang.IllegalArgumentException:找不到具有操作名称{http://acct.poc.cog.com/} getAccountInfo的BindingOperationInfo。请检查operationName和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] 在org.apache.camel.component.cxf.CxfProducer.process(CxfProducer.java:110)[camel-cxf-2.16.0.jar:2.16.0] 在org.apache.camel.processor.SendProcessor.process(SendProcessor.java:141)[camel-core-2.16.0.jar:2.16.0]
答案 0 :(得分:5)
您是否也尝试过设置:
<setHeader headerName="operationNamespace">
<constant>http://acct.poc.cog.com/</constant>
</setHeader>
在JAVA DSL中我猜:
from("direct:invokeMyUpdate")
.bean("myAcctSvcClient", "buildSoapReq")
.setHeader(CxfConstants.OPERATION_NAME, constant("getAccountInfo"))
.setHeader(CxfConstants.OPERATION_NAMESPACE, constant("http://acct.poc.cog.com/"))
.to("cxf:bean:accountEndpoint")
我的第二个提示是运行调试器并在第CxfProducer.java:379
行放置断点。比检查CxfProducer.client.conduitSelector.endpoint.binding.bindingInfo.operations
的值
我正在尝试解决类似的问题,其中从wsdl加载的操作集是空白的。
编辑:我找到了问题的根源,为什么创建的端点类型为org.apache.cxf.endpoint.EndpointImpl
而不是org.apache.cxf.jaxws.support.JaxWsEndpointImpl
,并且没有操作信息。 CxfEndpoint示例:
<cxf:cxfEndpoint
id="id"
...
serviceClass="service.class.name"
>
我错误地将service.class.name
声明为web服务客户端类,而不是webservice接口类。