Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Camel cxf:cxfEndpoint Producer error : Can't find the BindingOperationInfo with operation name

I am calling a soap service using camel cxf:cxfEndpoint but getting this BindingOperationInfo error. The configuration looks correct to me but not sure where I am doing wrong.

Endpoint configuration:

<!--  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>

My Java DSL Router configuration.

from("direct:invokeMyUpdate")
        .bean("myAcctSvcClient", "buildSoapReq")
        .setHeader(CxfConstants.OPERATION_NAME, constant("getAccountInfo"))
        .to("cxf:bean:accountEndpoint")

WSDL elements:

<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>

Below is the error :

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]

like image 950
kswaughs Avatar asked Dec 10 '15 06:12

kswaughs


1 Answers

Did you try to set also:

<setHeader headerName="operationNamespace">
  <constant>http://acct.poc.cog.com/</constant>
</setHeader>

In JAVA DSL I guess:

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")

The second tip from me is to run debugger and put breakpoint on line CxfProducer.java:379. Than check the value of CxfProducer.client.conduitSelector.endpoint.binding.bindingInfo.operations.
I am trying to solve the similar problem, where operations set loaded from wsdl are blank.

EDIT: I have found source of my problem, why the created endpoint was of type org.apache.cxf.endpoint.EndpointImpl instead of org.apache.cxf.jaxws.support.JaxWsEndpointImpl and had no operations info. CxfEndpoint example:

<cxf:cxfEndpoint
        id="id"
        ...
        serviceClass="service.class.name"
 >

I declared service.class.name as webservice client class by mistake, not as webservice interface class.

like image 118
kasi Avatar answered Oct 31 '22 20:10

kasi