14 Replies Latest reply on Nov 20, 2011 8:01 PM by Rachel Li

    camel-cxf no-pojo consumer

    Michael LaBrot Newbie

      I want to host a web service in FUSE ESB 4.3.1 using just a WSDL file and the CXF camel component (camel-cxf). Here is my simple XML config file (drop it into deploy/):

       

       

            <camel:from uri="cxf://0.0.0.0:9001/CxfTest?wsdlURL=file:examples/cxf-ws-rm/src/main/resources/HelloWorld.wsdl&amp;dataFormat=PAYLOAD&amp;serviceName=HelloWorldImplService&amp;portName=HelloWorldImplPort" />

            (CxfConsumer.java:251)[202:org.apache.camel.camel-cxf:2.6.0.fuse-00-00]

              at org.apache.camel.component.cxf.CxfEndpoint.createConsumer(CxfEndpoint.java:127)[202:org.apache.camel.camel-cxf:2.6.0.fuse-00-00]

              at org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:61)[68:org.apache.camel.camel-core:2.6.0.fuse-00-00]

              at org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:75)[68:org.apache.camel.camel-core:2.6.0.fuse-00-00]

              at org.apache.camel.impl.RouteService.warmUp(RouteService.java:118)[68:org.apache.camel.camel-core:2.6.0.fuse-00-00]

              at org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:1803)[68:org.apache.camel.camel-core:2.6.0.fuse-00-00]

              at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1729)[68:org.apache.camel.camel-core:2.6.0.fuse-00-00]

              at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1528)[68:org.apache.camel.camel-core:2.6.0.fuse-00-00]

              at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1420)[68:org.apache.camel.camel-core:2.6.0.fuse-00-00]

              at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1321)[68:org.apache.camel.camel-core:2.6.0.fuse-00-00]

              at org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:164)[75:org.apache.camel.camel-spring:2.6.0.fuse-00-00]

              at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)[68:org.apache.camel.camel-core:2.6.0.fuse-00-00]

              at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)[68:org.apache.camel.camel-core:2.6.0.fuse-00-00]

              at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1299)[68:org.apache.camel.camel-core:2.6.0.fuse-00-00]

              at org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:203)[75:org.apache.camel.camel-spring:2.6.0.fuse-00-00]

              at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:101)[75:org.apache.camel.camel-spring:2.6.0.fuse-00-00]

              ... 10 more

       

      Help?

        • 1. Re: camel-cxf no-pojo consumer
          Daryl Hoyt Newbie

          I'm having the exact same issue.  It doesn't seem to matter if the route is XML or Java.

          • 2. Re: camel-cxf no-pojo consumer
            Willem Jiang Master

            Please specify the portName option in the camel-cxf URI.

            • 3. Re: camel-cxf no-pojo consumer
              Michael LaBrot Newbie

              Please look again at my URI. The portName is already specified.

              • 4. Re: camel-cxf no-pojo consumer
                Willem Jiang Master

                No, you just specify the ServiceName, please double check it .

                • 5. Re: camel-cxf no-pojo consumer
                  Michael LaBrot Newbie

                  The portName is indeed specified. Here's the breakdown of the URI from above:

                   

                  Component: cxf

                  URL: //0.0.0.0:9001/CxfTest

                  Parameters:

                  wsdlURL=file:examples/cxf-ws-rm/src/main/resources/HelloWorld.wsdl

                  dataFormat=PAYLOAD

                  serviceName=HelloWorldImplService

                  portName=HelloWorldImplPort

                   

                  I'd very much appreciate it if someone could provide a working example of how to expose the examples/cxf-ws-rm/src/main/resources/HelloWorld.wsdl as a CxfConsumer using only the WSDL and no Java. I've read that it is possible, but have never seen an example, and my attempt is obviously broken.

                  • 6. Re: camel-cxf no-pojo consumer
                    Michael LaBrot Newbie

                    The portName is specified as the last parameter in the URI. It is set to "HelloWorldImplPort".

                    • 8. Re: camel-cxf no-pojo consumer
                      Michael LaBrot Newbie

                      Thanks. I had tried the portName with and without the namespace and met with exceptions either way. So here's where I have now based on what I saw in your example:

                       

                       

                            <camel:from uri="cxf://http://0.0.0.0:9001/CxfTest?portName=HelloWorldImplPort&amp;service

                      Name=HelloWorldImplService&amp;wsdlURL=file:examples/cxf-ws-rm/src/main/resources/HelloWorld.wsd

                      l&amp;dataFormat=PAYLOAD&amp;loggingFeatureEnabled=true" />

                            (CxfConsumer.java:251)[210:org.apache.camel.camel-cxf:2.6.0.fuse-00-00]

                              at org.apache.camel.component.cxf.CxfEndpoint.createConsumer(CxfEndpoint.java:127)[210:org.apache.camel.camel-cxf:2.6.0.fuse-00-00]

                              at org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:61)[69:org.apache.camel.camel-core:2.6.0.fuse-00-00]

                              at org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:75)[69:org.apache.camel.camel-core:2.6.0.fuse-00-00]

                              at org.apache.camel.impl.RouteService.warmUp(RouteService.java:118)[69:org.apache.camel.camel-core:2.6.0.fuse-00-00]

                              at org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:1803)[69:org.apache.camel.camel-core:2.6.0.fuse-00-00]

                              at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1729)[69:org.apache.camel.camel-core:2.6.0.fuse-00-00]

                              at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1528)[69:org.apache.camel.camel-core:2.6.0.fuse-00-00]

                              at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1420)[69:org.apache.camel.camel-core:2.6.0.fuse-00-00]

                              at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1321)[69:org.apache.camel.camel-core:2.6.0.fuse-00-00]

                              at org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:164)[76:org.apache.camel.camel-spring:2.6.0.fuse-00-00]

                              at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)[69:org.apache.camel.camel-core:2.6.0.fuse-00-00]

                              at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)[69:org.apache.camel.camel-core:2.6.0.fuse-00-00]

                              at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1299)[69:org.apache.camel.camel-core:2.6.0.fuse-00-00]

                              at org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:203)[76:org.apache.camel.camel-spring:2.6.0.fuse-00-00]

                              at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:101)[76:org.apache.camel.camel-spring:2.6.0.fuse-00-00]

                              ... 10 more

                      • 9. Re: camel-cxf no-pojo consumer
                        Michael LaBrot Newbie

                        Update: I no longer get an exception when I deploy the following XML. But now, even though I see "Setting the server's publish address to be http://0.0.0.0:9001/CxfTest" in the log, nothing is listening on port 9001.

                         

                         

                              <camel:from uri="cxf://http://0.0.0.0:9001/CxfTest?portName=HelloWorldImplPort&amp;serviceName=HelloWorldImplService&amp;wsdlURL=file:examples/cxf-ws-rm/src/main/resources/HelloWorld.wsdl&amp;dataFormat=PAYLOAD&amp;loggingFeatureEnabled=true" />

                              <camel:to uri="log:test" />

                            </camel:route>

                          </camel:camelContext>

                         

                        </beans>

                        • 10. Re: camel-cxf no-pojo consumer
                          Willem Jiang Master

                          Hi,

                           

                          You are using the CXF servlet transport.

                           

                           

                           

                           

                          Willem

                          • 11. Re: camel-cxf no-pojo consumer
                            Michael LaBrot Newbie

                            Willem,

                             

                            Many thanks. The working solution for posterity:

                             

                             

                                  <camel:from uri="cxf://http://0.0.0.0:9001/CxfTest?portName=HelloWorldImplPort&amp;serviceName=HelloWorldImplService&amp;wsdlURL=file:examples/cxf-ws-rm/src/main/resources/HelloWorld.wsdl&amp;dataFormat=PAYLOAD&amp;loggingFeatureEnabled=true" />

                                  <camel:to uri="log:test" />

                                </camel:route>

                              </camel:camelContext>

                             

                            </beans>

                            • 12. Re: camel-cxf no-pojo consumer
                              Rachel Li Newbie

                              I meet a problem while I use the configuration you provided, even if I change the port from 80 to 9999, the same exception occurs. Will you help me out?

                               

                              Exception in thread "main" org.apache.cxf.interceptor.Fault: Could not start Jetty server on port 80: Cannot assign requested address: bind

                                   at org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.addServant(JettyHTTPServerEngine.java:404)

                                   at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.activate(JettyHTTPDestination.java:166)

                                   at org.apache.cxf.transport.AbstractObservable.setMessageObserver(AbstractObservable.java:48)

                                   at org.apache.cxf.binding.AbstractBaseBindingFactory.addListener(AbstractBaseBindingFactory.java:97)

                                   at org.apache.cxf.binding.soap.SoapBindingFactory.addListener(SoapBindingFactory.java:836)

                                   at org.apache.cxf.endpoint.ServerImpl.start(ServerImpl.java:131)

                                   at org.apache.camel.component.cxf.CxfConsumer.doStart(CxfConsumer.java:235)

                                   at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)

                                   at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)

                                   at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:56)

                                   at org.apache.camel.impl.DefaultCamelContext.startServices(DefaultCamelContext.java:1624)

                                   at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:1900)

                                   at org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultCamelContext.java:1855)

                                   at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1783)

                                   at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1559)

                                   at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1449)

                                   at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1338)

                                   at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)

                                   at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)

                                   at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1316)

                              • 13. Re: camel-cxf no-pojo consumer
                                Freeman(Yue) Fang Master

                                Hi,

                                 

                                Seems your change didn't take effect at all, it still try to bind to port 80, but port 80 is only for root to bind, what did you change? Did you uninstall the old bundle?

                                 

                                Freeman

                                • 14. Re: camel-cxf no-pojo consumer
                                  Rachel Li Newbie

                                  Thanks for reply, what I mean is even if I change the port, the same exception occurs. Just the port changed, the rest is the same. I don't think it's related to the port, but I don't know why this happens.

                                   

                                  Exception in thread "main" org.apache.cxf.interceptor.Fault: Could not start Jetty server on port 9999: Cannot assign requested address: bind