2 Replies Latest reply on Mar 20, 2012 8:32 PM by njiang

    CXF Consumer/Producer issue in route

    eric.bender

      I have a simple cxf consumer and producer route setup currently, but for some reason when I go to deploy the route i am getting the following error.

       

      03:07:10,014 | ERROR | xtenderThread-22 | ContextLoaderListener            | ?                                   ? | 84 - org.springframework.osgi.extender - 1.2.1 | Application context refresh failed (OsgiBundleXmlApplicationContext(bundle=mdm-realtime-route, config=osgibundle:/META-INF/spring/*.xml))
      org.apache.camel.RuntimeCamelException: org.apache.cxf.service.factory.ServiceConstructionException: Could not find definition for service {urn:enterprise.soap.sforce.com}SoapService.
              at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1149)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
              at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:108)[91:org.apache.camel.camel-spring:2.8.0.fuse-01-13]
              at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:240)[91:org.apache.camel.camel-spring:2.8.0.fuse-01-13]
              at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)[75:org.springframework.context:3.0.5.RELEASE]
              at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)[75:org.springframework.context:3.0.5.RELEASE]
              at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911)[75:org.springframework.context:3.0.5.RELEASE]
              at org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext.finishRefresh(AbstractOsgiBundleApplicationContext.java:235)[81:org.springframework.osgi.core:1.2.1]
              at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:358)[81:org.springframework.osgi.core:1.2.1]
              at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[81:org.springframework.osgi.core:1.2.1]
              at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)[81:org.springframework.osgi.core:1.2.1]
              at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)[84:org.springframework.osgi.extender:1.2.1]
              at java.lang.Thread.run(Thread.java:662)[:1.6.0_23]
      Caused by: org.apache.cxf.service.factory.ServiceConstructionException: Could not find definition for service {urn:enterprise.soap.sforce.com}SoapService.
              at org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:139)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
              at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:382)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
              at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:505)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
              at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:241)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
              at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:202)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
              at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
              at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:157)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
              at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:202)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
              at org.apache.camel.component.cxf.CxfConsumer.<init>(CxfConsumer.java:226)[143:org.apache.camel.camel-cxf:2.8.0.fuse-01-13]
              at org.apache.camel.component.cxf.CxfEndpoint.createConsumer(CxfEndpoint.java:188)[143:org.apache.camel.camel-cxf:2.8.0.fuse-01-13]
              at org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:61)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
              at org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:75)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
              at org.apache.camel.impl.RouteService.warmUp(RouteService.java:124)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
              at org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:1862)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
              at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1790)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
              at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1575)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
              at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1465)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
              at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1349)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
              at org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:167)[91:org.apache.camel.camel-spring:2.8.0.fuse-01-13]
              at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
              at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
              at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1317)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
              at org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:211)[91:org.apache.camel.camel-spring:2.8.0.fuse-01-13]
              at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:106)[91:org.apache.camel.camel-spring:2.8.0.fuse-01-13]
              ... 10 more
      

       

      My route is quite simple:

                        <from uri="cxf:bean:salesforceCXFConsumer" />
                        <log message="Incoming message"></log>
                      <to uri="cxf:bean:salesforceCXFProducer"></to>
      

      And the bean definitions are

           <cxf:cxfEndpoint
                   id="salesforceCXFConsumer"
                   address="http://0.0.0.0:9191/JavelinSalesforce"
                   wsdlURL="wsdl/sfdc.wsdl"
                   serviceClass="com.sforce.soap.enterprise.Soap">
                   <cxf:properties>
                       <entry key="schema-validation-enabled" value="true"></entry>
                   </cxf:properties>
           </cxf:cxfEndpoint>       
      
      
           <cxf:cxfEndpoint
                id="salesforceCXFProducer"
                address="https://login.salesforce.com/services/Soap/c/24.0/"
                wsdlURL="wsdl/sfdc.wsdl"
                serviceClass="com.sforce.soap.enterprise.Soap"
                serviceName="t:SforceService"
                endpointName="t:Soap"
                xmlns:t="urn:enterprise.soap.sforce.com">
                <cxf:properties>
                <entry key="dataFormat" value="POJO"></entry>
                    <entry key="receiveTimeout" value="120000"></entry>
                     <entry key="connectionTimeout" value="120000"></entry>
                     <entry key="validateBeforeWrite" value="true"></entry>
                     <entry key="validateOutput" value="true"></entry>
                </cxf:properties>          
           </cxf:cxfEndpoint> 
      

      I have looked through the WSDL and such and am having trouble understanding why servicemix is looking for a SoapService class when I give it just the class name of Soap, which is defined in the WSDL (and verified to exist when I generate the stubs from it)  I have done this before with other services and not encountered an issue, so I am unsure of what I am doing wrong.

       

          ... xmlns:tns="urn:enterprise.soap.sforce.com" ...
          <service name="SforceService">
              <documentation>Sforce SOAP API</documentation>
              <port binding="tns:SoapBinding" name="Soap">
                  <soap:address location="https://login.salesforce.com/services/Soap/c/24.0/"></soap:address>
              </port>
          </service>
      

       

        • 1. Re: CXF Consumer/Producer issue in route
          ffang

          Hi,

           

          The error comes from that when try to init camel-cxf consumer, can't find the service SoapService from wsdl.

           

          Looked your camel-cxf consumer definition, it's

                        

          So most likely, it's in "com.sforce.soap.enterprise.Soap" class which has annotation like service but it's not in your wsdl, you need check your "com.sforce.soap.enterprise.Soap" source.

           

          Freeman

          • 2. Re: CXF Consumer/Producer issue in route
            njiang

            If you specify the wsdlURL attribute, CXF will try to build the service module from WSDL.

            It looks like the com.sforce.soap.enterprise.Soap doesn't provides enough information for CXF to pick up right service name.

            Can you try to add the serviceName and endpointName like the salesforceCXFProducer does ?

             

            Willem