4 Replies Latest reply on Nov 17, 2009 2:03 PM by Lyfe Musique

    CXF consumer and provider configuration

    m k Newbie

      Hello.

       

      I'll be glad if someone could chceck my cxfbc:consumer and cxfbc:provider acording to my WSDL

       

      Here is WSDL service.wsdl:

       

      <wsdl:types>

                <xsd:schema targetNamespace="http://servicemix.apache.org/examples/types"

                            elementFormDefault="qualified">

                     <xsd:element name="SayHello">

                       <xsd:complexType>

                               <xsd:sequence>

                                    <xsd:element name="name" type="xsd:string"/>

                               </xsd:sequence>

                          </xsd:complexType>

                     </xsd:element>

                     <xsd:element name="SayHelloResponse">

                       <xsd:complexType>

                               <xsd:sequence>

                                    <xsd:element name="name" type="xsd:string"/>

                               </xsd:sequence>

                          </xsd:complexType>

                     </xsd:element>

                     <xsd:element name="UnknownWordFault">

                       <xsd:complexType>

                               <xsd:sequence>

                                   <xsd:element name="word" type="xsd:string"/>

                               </xsd:sequence>

                          </xsd:complexType>

                     </xsd:element>

                </xsd:schema>

        </wsdl:types>

       

           <wsdl:message name="SayHelloRequest">

                <wsdl:part name="payload" element="typens:SayHello"/>

           </wsdl:message>

           <wsdl:message name="SayHelloResponse">

                <wsdl:part name="payload" element="typens:SayHelloResponse"/>

           </wsdl:message>

           <wsdl:message name="UnknownWordFault">

                <wsdl:part name="payload" element="typens:UnknownWordFault"/>

           </wsdl:message>

       

          <wsdl:portType name="Hello">

                <wsdl:operation name="SayHello">

                     <wsdl:input message="tns:SayHelloRequest"/>

                     <wsdl:output message="tns:SayHelloResponse"/>

                     <wsdl:fault name="UnknownWord" message="tns:UnknownWordFault"/>

                </wsdl:operation>

           </wsdl:portType>

       

      <wsdl:binding name="HelloSOAPBinding" type="tns:Hello">

               <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />

                <wsdl:operation name="SayHello">

                     <wsdl:input>

                          <soap:body use="literal" />

                     </wsdl:input>

                     <wsdl:output>

                          <soap:body use="literal" />

                     </wsdl:output>

                     <wsdl:fault name="UnknownWord">

                          <soap:fault use="literal" name="UnknownWord" />

                     </wsdl:fault>

             </wsdl:operation>

      </wsdl:binding>

       

      <wsdl:service name="HelloService">

           <wsdl:port binding="tns:HelloSOAPBinding" name="soap">

                 <soap:address location="http://localhost:8193/HelloService/" />

             </wsdl:port>

      </wsdl:service>

      </wsdl:definitions>

       

      And here xbean.xml:

       

       

       

      service.wsdl is same in consumer and provider.

       

      And my questions:

       

      In consumer:

      1. service refers to name in <wsdl:service name="HelloService">??

      2. endpoint refers to name in <wsdl:port binding="tns:HelloSOAPBinding" name="soap">??

      3. targetEndpoint also refers to name in  <wsdl:port binding="tns:HelloSOAPBinding" name="soap">??

      4. targetService refers to name in <wsdl:service name="HelloService">??

      5. targetInterface refers to name in <wsdl:portType name="Hello">??

      6. locationURI will override location in <soap:address location="http://localhost:8193/HelloService/" />??

      7. Are my tags in consumer correct acording to my wsdl??

       

      In provider:

      1. service refers to targetService in consumer??

      2. What does locationURI ??

      3. endpoint refers to targetEndpoint in consumer??

      4. interfaceName refers to targetInterface in consumer??

       

      My xbean.xml is not working when I deploy service assembly.

       

      What is correct tags definitions in my xbean.xml acording to my service.wsdl??

       

      Please help!

       

      MK

       

      Edited by: kumako22 on Oct 25, 2009 9:06 AM

        • 1. Re: CXF consumer and provider configuration
          Dave Stanley Novice

          In consumer:

          1. service refers to name in

           

          so flow is:

           

            ---> [ ESB (8192)-[cxfbc-consumer][cxfbc-provider] ] -


          > (9001)[backend-service]

           

          Provider Questions:

           

          1. service refers to targetService in consumer??

          Thats just the service name for your provider (nothing to do with the consumer)

           

           

          2. What does locationURI ??

          Thats the uri where the provider is going to send its request to, so it expects there is a service listening on that host:port.

           

          3. endpoint refers to targetEndpoint in consumer??

          Thats the endpoint name of your provider (nothing to do with the consumer)

           

          4. interfaceName refers to targetInterface in consumer??

          This is the interface name as per your wsdl (nothing to do with the consumer))

           

          Hope that helps

          /Dave

          • 2. Re: CXF consumer and provider configuration
            Dave Stanley Novice

            One last piece of configuration, I think you will need to set useJBIWrapper=false.

             

             <cxfbc:consumer wsdl="classpath:service.wsdl"
                    service="hello:HelloServiceIn" endpoint="HelloIn"
                      targetService="hello:HelloService" targetInterface="hello:Hello"
                      useJBIWrapper="false" synchronous="false">
                      
                        <cxfbc:inInterceptors>
                        <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"></bean>
                      </cxfbc:inInterceptors>
                      <cxfbc:outInterceptors>
                        <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"></bean>
                      </cxfbc:outInterceptors>
                      <cxfbc:inFaultInterceptors>
                        <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"></bean>
                      </cxfbc:inFaultInterceptors>
                      <cxfbc:outFaultInterceptors>
                        <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"></bean>
                      </cxfbc:outFaultInterceptors>
                      
              </cxfbc:consumer>          
                      
              
              <cxfbc:provider wsdl="classpath:service.wsdl"
                                  service="hello:HelloService"
                                  interfaceName="hello:Hello"
                                  useJBIWrapper="false">
                                  
                        <cxfbc:inInterceptors>
                        <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"></bean>
                      </cxfbc:inInterceptors>
                      <cxfbc:outInterceptors>
                        <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"></bean>
                      </cxfbc:outInterceptors>
                      <cxfbc:inFaultInterceptors>
                        <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"></bean>
                      </cxfbc:inFaultInterceptors>
                      <cxfbc:outFaultInterceptors>
                        <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"></bean>
                      </cxfbc:outFaultInterceptors>
              
              </cxfbc:provider>        
            
            

             

            • 3. Re: CXF consumer and provider configuration
              m k Newbie

              Hello,

               

              I'm confused.

               

              That is correct flow you wrote and I would like to do it

               

              *external client ===> esb consumer endpoint===> esb provider endpoint* 

              *==> external service*

               

              My service.wsdl and service are on localhost

               

               

               

              Whena I deploy it to hotdeploy I get messages:

              -Endpoint ServiceEndpoint[service={[http://servicemix.apache.org/examples]} HelloService, endpoint=soapPortProxy] has a service description but no matching endpoint found in

              -Could not determine bean name for instance of class org.apache.cxf.transport.jbi.JBIDestination

               

              I also want to test it in soapUI by connecting to http://localhost:9000/HelloService/Soap/service?wsdl but after I sent request I gain error:

               

              <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

                 <soap:Body>

                    <soap:Fault>

                       <faultcode>soap:Server</faultcode>

                       <faultstring>Fault occurred while processing.</faultstring>

                    </soap:Fault>

                 </soap:Body>

              </soap:Envelope>

               

              What is wrong? How can i do my schema properly??

               

              Best regards,

              MK

              • 4. Re: CXF consumer and provider configuration
                Lyfe Musique Novice

                pls take a look at my thread (http://fusesource.com/forums/thread.jspa?threadID=1424&tstart=0).  I had a similar issue you're facing.