5 Replies Latest reply on Apr 26, 2011 9:31 AM by dropping

    CXF proxy webservice, camel route and spring

    dropping

      Hello everybody,

       

      I would like to establish a CXF webservice as a proxy, in order to inject a request in a camel route.

       

      Here is a general schema :

      External Call => Proxy WebService => camel route => response at the end of the route

       

      I found an example with camel 2.7 which looks like what I want (camel-example-cxf-proxy), but I failed to deploy it on servicemix 4.2 despite instructions.

       

      My webservice is generated from a wsdl, and works correctly with a simple HelloWorld. The problem is that I can't inject this webservice's calls in the camel route, and send a response when the route is completed.

       

      I think the <cxfbc:consumer> tag is the one that should be used, but I saw in the camel example that the <cxf:cxfEndpoint> tag is used. What is the difference ?

       

      Could you help me by telling me how to achieve this ?

       

      Thanks a lot !

        • 1. Re: CXF proxy webservice, camel route and spring
          davsclaus

          You may want to look at some webinars covering web services with ServiceMix and Camel. There are 3 webinars in total

          http://fusesource.com/resources/video-archived-webinars/

           

          The <cxfbc:consumer> is the old JBI component.

          The <cxf:cxfEndpoint> is the Apache CXF / Camel component.

           

          JBI is discouraged to use for new projects.

          http://gnodet.blogspot.com/2010/12/thoughts-about-servicemix.html

          • 2. Re: CXF proxy webservice, camel route and spring
            davsclaus

            And you may want to pickup and try SMX 4.3. You can download it from here http://fusesource.com/downloads/. The Camel proxy example should work on that version.

             

            SMX 4.2 is about 1 year old and its recommended to upgrade.

            • 3. Re: CXF proxy webservice, camel route and spring
              dropping

              Hello davsclaus,

               

              Thank you very much for your answer.

               

              Unfortunetaly, I failed again when trying with SMX 4.3. I think I missed something about how it works...

               

              The Junit test (and the main class) works that's why I think all the code is good.

               

              How can i deploy this example on SMX ? I try to copy the camel-example-cxf-proxy-2.7.1.jar into the deploy folder. After that the bundle is in "installed" state and i can't see the wsdl at this address : http://localhost:9080/camel-example-cxf-proxy/webservices/incident?wsdl

               

              thanks again for your help

              • 4. Re: CXF proxy webservice, camel route and spring
                dropping

                After some changement in the pom.xml i get the following stack trace when deploying the bundle :

                 

                used by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'cxf:cxfEndpoint'.

                     at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:233)[:]

                     at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:169)[:]

                     at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:420)[:]

                     at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:354)[:]

                     at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:455)[:]

                     at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3220)[:]

                     at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1965)[:]

                     at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.emptyElement(XMLSchemaValidator.java:763)[:]

                     at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:391)[:]

                     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2769)[:]

                     at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:662)[:]

                     at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:154)[:]

                     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:525)[:]

                     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:853)[:]

                     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:782)[:]

                     at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:157)[:]

                     at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:273)[:]

                     at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:322)[:]

                     at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)[59:org.springframework.beans:3.0.5.RELEASE]

                     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)[59:org.springframework.beans:3.0.5.RELEASE]

                 

                 

                Thanks

                • 5. Re: CXF proxy webservice, camel route and spring
                  dropping

                  Ok all is good now :).

                   

                  Thanks for your help. In order to deploy the camel-cxf-proxy into SMX 4.3 :

                   

                  - Change the pom.xml to specify a version (2.6.0) for camel dependencies

                  - enable camel-cxf and camel-http in SMX with the command :

                     features:install camel-cxf

                     features:install camel-http

                   

                  Hope it helps

                   

                  Thanks again

                   

                  Edited by: dropping on Apr 26, 2011 1:30 PM

                   

                  Edited by: dropping on Apr 26, 2011 1:30 PM