5 Replies Latest reply on Jul 19, 2010 8:55 PM by njiang

    Trouble with cxfbc to Camel route

    klimperos

      Hello,

       

      I am having some difficulty with cxfbc to Camel interaction. The goal is to accept a SOAP message in cxfbc and route it to Camel for output to a file.

       

      I am running ServiceMix 3.3.2 and have a cxfbc consumer defined as follows:

       

       

       

      However, when I attempt to send a SOAP message to cxfbc it appears not to be able to find wtservice and wtendpoint:

       

      WARN  - CxfBcComponent                 - Target service (wtservice) and endpoint (wtendpoint) specified, but no matching endpoint found.  Only the service will be used for routing.

       

      and

       

      org.apache.cxf.interceptor.Fault: Could not find route for exchange: InOut[

              id: ID:174.141.128.19-129eca1e194-3:0

              status: Active

              role: provider

              service: wtservice

              operation: getPerson

              in: <?xml version="1.0" encoding="UTF-8"?><jbi:message xmlns:jbi="http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper" xmlns:msg="http://poc.test.com/POC/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="getPerson" type="msg:getPerson" version="1.0"><jbi:part><poc:getPerson xmlns:poc="http://poc.test.com/POC/">

                         

                  </poc:getPerson></jbi:part></jbi:message>

      ]

       

      If I try changing the endpoint?s mep explicitly to in-out as follows:

       

       

       

      the error persists from cxfbc, but then the camel file input route breaks, because it wants an in-only endpoint.

       

      Any ideas for how to correct the cxfbc to Camel communication?

       

      Thank you.

       

      Kevin

        • 1. Re: Trouble with cxfbc to Camel route
          ffang

          Hi,

           

          The from uri in your camel route should be

          jbi:endpoint:serviceNamespace[sep]serviceName[sep]endpointName[?options]

           

          here the serviceNamespace should be http://poc.test.com/POC/ but not the prefix poc.

           

          Freeman

          • 2. Re: Trouble with cxfbc to Camel route
            njiang

            Hi

             

            Your cxfbc target service has the namespace prefix definition.

            Please use this uri for your camel jbi endpoint to receive the request from cxfbc.

            "jbi:endpoint:http://poc.test.com/POC/wtservice/wtendpoint"

             

            Then you can send the response back after the file endpoint from the camel route.

             

            Willem

            • 3. Re: Trouble with cxfbc to Camel route
              klimperos

              Freeman, Willem,

               

              It turned out that since my poc namespace is "http://poc.test.com/POC/" that a second '/' is required after POC to form the uri correctly to match:

               

               

               

              Curiously, while I don't explicitly send any reply back to cxfbc, my test client received a reply with a copy of the input message. Any thoughts as to why this occurs? Also, why doesn't the above uri require an explicit mep=in-out since cxfbc is expecting a reply?

               

              Thank you - I appreciate your help.

               

              Kevin

              • 4. Re: Trouble with cxfbc to Camel route
                ffang

                Hi,

                 

                Cxf bc will create Message Exchange Pattern(InOnly or InOut) based on the servicemodel(which is generated from the wsdl you specified for cxf bc consumer) automatically, so you needn't specify the MEP yourself, all is based on the wsdl.

                 

                Freeman

                • 5. Re: Trouble with cxfbc to Camel route
                  njiang

                  Camel pipeline processor will copy the in message from the last exchange back to the first exchange out message, if the last exchange doesn't have the out message.

                  So it is not strange to see the request message return, as I said you need to put the response message back by using the setOutBody() or processor() DSL.

                   

                  Willem