It looks there are more than one version of CXF in your class patch, can you double check it?
-- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang Weibo: 姜宁willem On March 30, 2015 at 7:16:36 PM, Willian Antunes ([email protected]) wrote: > I am trying to understand how to integrate Apache Camel with any web > service that provides a WSDL. > > I've studied a little about camel-spring-ws > and camel-cxf > packages. As I can see Spring Web > Services Component does not support the use of WSDL but CXF does, however > it only supports connections with JAX-WS services hosted in CXF. > > If I receive a WSDL from a customer, could I use CXF? Or would I need to > create a custom component to use his methods? > > As far as I can see the simplest way to implement it would be creating a > Process or a Bean to invokes the remote web service or to configure the CXF > before the task. > > I've tried to implement a producer to set the CXF call to a remove web > service . My beans.xml: > > > xmlns="http://www.springframework.org/schema/beans" > xmlns:camel="http://camel.apache.org/schema/spring" > xmlns:cxf="http://camel.apache.org/schema/cxf" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans-3.0.xsd > http://camel.apache.org/schema/spring > http://camel.apache.org/schema/spring/camel-spring.xsd > http://camel.apache.org/schema/cxf > http://camel.apache.org/schema/cxf/camel-cxf.xsd"> > > > > > id="osvEndpoint" > address="http://10.193.1.90:8767/" > serviceClass="siemens_hiq8000.SiemensHiq8000PortType"/> > > > class="br.com.willianantunes.logger.DownloadLogger" /> > > class="br.com.willianantunes.logger.MessageFromQueueLogger" /> > > class="br.com.willianantunes.processor.OsvWebServiceProcessor" /> > > > My route: > > > xmlns="http://www.springframework.org/schema/beans" > xmlns:camel="http://camel.apache.org/schema/spring" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans-3.0.xsd > http://camel.apache.org/schema/spring > http://camel.apache.org/schema/spring/camel-spring.xsd"> > > > xmlns="http://camel.apache.org/schema/spring"> > > > > > > > > > > And my processor: > > public class OsvWebServiceProcessor implements Processor{ > @Override > public void process(Exchange exchange) throws Exception > { > Message inMessage = exchange.getIn(); > > // The method to be called > inMessage.setHeader(CxfConstants.OPERATION_NAME, "getVersion"); > > // Parameters to be passed into the web service > List params = new ArrayList(); > ResultCodeStructHolder resultCodeStructHolder = new > ResultCodeStructHolder(); > VersionDataHolder versionDataHolder = new VersionDataHolder(); > params.add(resultCodeStructHolder); > params.add(versionDataHolder); > inMessage.setBody(params); > }} > > > The method getVersion needs some parameters as followed: > > public void getVersion(siemens_hiq8000.holders.ResultCodeStructHolder result, > > siemens_hiq8000.holders.VersionDataHolder versionData) throws > java.rmi.RemoteException; > > How can I pass them? These holders must be filled with the response of the > web service. When I run my project I get the following error: > > [main] INFO org.apache.cxf.service.factory.ReflectionServiceFactoryBean > - Creating Service {http://siemens_hiq8000/}SiemensHiq8000PortType > from class siemens_hiq8000.SiemensHiq8000PortTypeException in thread > "main" java.lang.NoSuchMethodError: > org.apache.cxf.wsdl11.WSDLEndpointFactory.createEndpointInfo(Lorg/apache/cxf/service/model/ServiceInfo;Lorg/apache/cxf/service/model/BindingInfo;Ljava/util/List;)Lorg/apache/cxf/service/model/EndpointInfo; > > at > org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpointInfo(AbstractWSDLBasedEndpointFactory.java:287) > > at > org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:144) > > at > org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:91) > at > org.apache.camel.component.cxf.CxfSpringEndpoint.createClient(CxfSpringEndpoint.java:116) > > at org.apache.camel.component.cxf.CxfProducer.doStart(CxfProducer.java:76) > at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) > at > org.apache.camel.impl.DefaultCamelContext.startService(DefaultCamelContext.java:2869) > > at > org.apache.camel.impl.DefaultCamelContext.doAddService(DefaultCamelContext.java:1097) > > at > org.apache.camel.impl.DefaultCamelContext.addService(DefaultCamelContext.java:1058) > > at org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:405) > at > org.apache.camel.impl.ProducerCache.acquireProducer(ProducerCache.java:123) > at org.apache.camel.processor.SendProcessor.doStart(SendProcessor.java:219) > at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) > at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74) > at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59) > at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103) > at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:89) > at > org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:79) > > at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) > at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74) > at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59) > at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103) > at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:89) > at > org.apache.camel.processor.RedeliveryErrorHandler.doStart(RedeliveryErrorHandler.java:1272) > > at > org.apache.camel.support.ChildServiceSupport.start(ChildServiceSupport.java:44) > > at > org.apache.camel.support.ChildServiceSupport.start(ChildServiceSupport.java:31) > > at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74) > at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59) > at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103) > at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:89) > at > org.apache.camel.processor.interceptor.DefaultChannel.doStart(DefaultChannel.java:153) > > at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) > at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74) > at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59) > at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103) > at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:61) > at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103) > at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:89) > at > org.apache.camel.processor.MulticastProcessor.doStart(MulticastProcessor.java:1060) > > at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) > at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74) > at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59) > at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103) > at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:89) > at > org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:79) > > at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) > at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74) > at > org.apache.camel.impl.RouteService.startChildService(RouteService.java:340) > at org.apache.camel.impl.RouteService.warmUp(RouteService.java:182) > at > org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:3090) > > at > org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3020) > > at > org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:2797) > > at > org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:2653) > > at > org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:167) > > at > org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2467) > > at > org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2463) > > at > org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2486) > > at > org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2463) > > at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) > at > org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2432) > > at > org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:255) > > at > org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:121) > > at > org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:332) > > at > org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:151) > > at > org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128) > > at > org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:331) > > at > org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:773) > > at > org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483) > > at > org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139) > > at > org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:93) > > at > org.apache.camel.spring.Main.createDefaultApplicationContext(Main.java:216) > at org.apache.camel.spring.Main.doStart(Main.java:156) > at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) > at org.apache.camel.main.MainSupport.run(MainSupport.java:150) > at br.com.willianantunes.test.Program.main(Program.java:12) > > > I didn't set the options *wsdlURL* because I had generated the stub classes > before to use for my own custom solution, but know I am trying to move > forward using an integration framework like Apache Camel. > > Thanks, > Antunes >
