2 Replies Latest reply on Aug 28, 2011 2:22 AM by Claus Ibsen

    Dynamic CXF Client:  No operation was found with the name

    Michał Warecki Novice

      Hi,

       

      I'm trying to implement dynamic CXF client with Camel and I have problem with exception "org.apache.cxf.common.i18n.UncheckedException: No operation was found with the name fetchCustomer." This operation is defined in wsdl.

       

      Dynamic client code:

      public class DynamicServiceInvoker {
           
           @EndpointInject
           private ProducerTemplate producer;
           
           public void invokeService(Exchange exchange) throws Exception {
                Message in = exchange.getIn();
                ServiceDetail serviceDetail = (ServiceDetail) in.getHeader("serviceDetail");
                String operationName = (String) in.getHeader("operationName");
                Object payload = in.getBody();
                String wsdlAddress = serviceDetail.getBusinessService().get(0).getBindingTemplates()
                                                          .getBindingTemplate().get(0).getAccessPoint().getValue();
                
                Object result = producer.requestBodyAndHeader("cxf:bean:cxfEndpoint?wsdlURL=" + wsdlAddress + "&dataFormat=PAYLOAD",
                          payload, CxfConstants.OPERATION_NAME, operationName);
                
                
           }
      
      }
      
      Payload is simple string "12345" and WSDL address is correct.
      
      

       

      WSDL:

       

      <?xml version='1.0' encoding='UTF-8'?><wsdl:definitions name="SearchCustomerServiceImplService" targetNamespace="http://service.crm.mw.wat.edu.pl/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://service.crm.mw.wat.edu.pl/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <wsdl:types>
      <xs:schema elementFormDefault="unqualified" targetNamespace="http://service.crm.mw.wat.edu.pl/" version="1.0" xmlns:tns="http://service.crm.mw.wat.edu.pl/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:element name="Order" type="tns:order"></xs:element>
      <xs:element name="RetailOrder" type="tns:retailOrder"></xs:element>
      <xs:element name="fetchCustomer" type="tns:fetchCustomer"></xs:element>
      <xs:element name="fetchCustomerResponse" type="tns:fetchCustomerResponse"></xs:element>
      <xs:complexType name="fetchCustomer">
          <xs:sequence>
            <xs:element minOccurs="0" name="arg0" type="xs:string"></xs:element>
          </xs:sequence>
        </xs:complexType>
      
      <xs:complexType name="fetchCustomerResponse">
          <xs:sequence>
            <xs:element minOccurs="0" name="Customer" type="tns:Customer"></xs:element>
          </xs:sequence>
        </xs:complexType>
      <xs:complexType name="Customer">
          <xs:sequence>
            <xs:element minOccurs="0" name="customerId" type="xs:string"></xs:element>
            <xs:element minOccurs="0" name="firstName" type="xs:string"></xs:element>
            <xs:element minOccurs="0" name="nationalIdentity" type="xs:string"></xs:element>
      
            <xs:element minOccurs="0" name="secondName" type="xs:string"></xs:element>
          </xs:sequence>
        </xs:complexType>
      <xs:complexType name="order">
          <xs:sequence>
            <xs:element minOccurs="0" name="customer" type="tns:Customer"></xs:element>
            <xs:element maxOccurs="unbounded" minOccurs="0" name="lines" nillable="true" type="tns:OrderLine"></xs:element>
            <xs:element minOccurs="0" name="orderId" type="xs:string"></xs:element>
            <xs:element minOccurs="0" name="seller" type="xs:string"></xs:element>
      
          </xs:sequence>
        </xs:complexType>
      <xs:complexType name="OrderLine">
          <xs:sequence>
            <xs:element minOccurs="0" name="discount" type="xs:double"></xs:element>
            <xs:element minOccurs="0" name="product" type="tns:Product"></xs:element>
            <xs:element minOccurs="0" name="quantity" type="xs:int"></xs:element>
          </xs:sequence>
        </xs:complexType>
      
      <xs:complexType name="Product">
          <xs:sequence>
            <xs:element minOccurs="0" name="available" type="xs:boolean"></xs:element>
            <xs:element minOccurs="0" name="defaultPrice" type="xs:double"></xs:element>
            <xs:element minOccurs="0" name="description" type="xs:string"></xs:element>
            <xs:element minOccurs="0" name="name" type="xs:string"></xs:element>
            <xs:element minOccurs="0" name="productId" type="xs:string"></xs:element>
          </xs:sequence>
        </xs:complexType>
      
      <xs:complexType name="retailOrder">
          <xs:complexContent>
            <xs:extension base="tns:order">
              <xs:sequence></xs:sequence>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:schema>
        </wsdl:types>
        <wsdl:message name="fetchCustomer">
      
          <wsdl:part element="tns:fetchCustomer" name="parameters">
          </wsdl:part>
        </wsdl:message>
        <wsdl:message name="fetchCustomerResponse">
          <wsdl:part element="tns:fetchCustomerResponse" name="parameters">
          </wsdl:part>
        </wsdl:message>
        <wsdl:portType name="SearchCustomerService">
          <wsdl:operation name="fetchCustomer">
      
            <wsdl:input message="tns:fetchCustomer" name="fetchCustomer">
          </wsdl:input>
            <wsdl:output message="tns:fetchCustomerResponse" name="fetchCustomerResponse">
          </wsdl:output>
          </wsdl:operation>
        </wsdl:portType>
        <wsdl:binding name="SearchCustomerServiceImplServiceSoapBinding" type="tns:SearchCustomerService">
          <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"></soap:binding>
          <wsdl:operation name="fetchCustomer">
      
            <soap:operation soapAction="" style="document"></soap:operation>
            <wsdl:input name="fetchCustomer">
              <soap:body use="literal"></soap:body>
            </wsdl:input>
            <wsdl:output name="fetchCustomerResponse">
              <soap:body use="literal"></soap:body>
            </wsdl:output>
          </wsdl:operation>
        </wsdl:binding>
      
        <wsdl:service name="SearchCustomerServiceImplService">
          <wsdl:port binding="tns:SearchCustomerServiceImplServiceSoapBinding" name="SearchCustomerServiceImplPort">
            <soap:address location="http://localhost:8082/Apteka.Zdrowie/crm/services/SearchCustomerService"></soap:address>
          </wsdl:port>
        </wsdl:service>
      </wsdl:definitions>
      

       

      What could be the reason of this exception?