I'm trying to consume web service using setHeader component. *My main goal here is not to write any java code and directly call the method with arguments.* As well I'm very much new to camel tools. So I would really expect your suggestion more. Please help me out in understanding and executing my task. I'll share all the sample works which I've done.
camel-context.xml <cxf:cxfEndpoint id="callCXF" address="http://localhost:1101/CustomDetails" serviceClass="com.webservice.CustomerMethod" serviceName="s:getHelloWorldMessage" xmlns:s="http://webservice.com"> <cxf:properties> <entry key="dataFormat" value="POJO" /> </cxf:properties> </cxf:cxfEndpoint> <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring" trace="true"> <route> <from uri="timer://foo?period=6000" /> <setHeader headerName="getHelloWorldMessage"> <simple>Hi</simple> </setHeader> <to uri="cxf:bean:callCXF" /> <log message=">>> data is : ${body}" /> </route> </camelContext> WSDL file: <?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://www.springframework.org/schema/beans" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns2="http://schemas.xmlsoap.org/soap/http" xmlns:ns1="http://webservice.com/" name="CustomerMethod" targetNamespace="http://www.springframework.org/schema/beans"> <wsdl:import location="http://localhost:1101/CustomDetails?wsdl=CustomerMethod.wsdl" namespace="http://webservice.com/"> </wsdl:import> <wsdl:binding name="CustomerMethodSoapBinding" type="ns1:CustomerMethod"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="getHelloWorldMessage"> <soap:operation soapAction="" style="rpc"/> <wsdl:input name="getHelloWorldMessage"> <soap:body namespace="http://webservice.com/" use="literal"/> </wsdl:input> <wsdl:output name="getHelloWorldMessageResponse"> <soap:body namespace="http://webservice.com/" use="literal"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="getNameAddPhnNo"> <soap:operation soapAction="" style="rpc"/> <wsdl:input name="getNameAddPhnNo"> <soap:body namespace="http://webservice.com/" use="literal"/> </wsdl:input> <wsdl:output name="getNameAddPhnNoResponse"> <soap:body namespace="http://webservice.com/" use="literal"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="getCustomerID"> <soap:operation soapAction="" style="rpc"/> <wsdl:input name="getCustomerID"> <soap:body namespace="http://webservice.com/" use="literal"/> </wsdl:input> <wsdl:output name="getCustomerIDResponse"> <soap:body namespace="http://webservice.com/" use="literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="CustomerMethod"> <wsdl:port binding="tns:CustomerMethodSoapBinding" name="SOAPOverHTTP"> <soap:address location="http://localhost:1101/CustomDetails"/> </wsdl:port> </wsdl:service> </wsdl:definitions> pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>EE-EAI</groupId> <artifactId>WebserviceConsume</artifactId> <version>0.0.1-SNAPSHOT</version> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> </properties> <repositories> <repository> <id>release.fusesource.org</id> <name>FuseSource Release Repository</name> <url>http://repo.fusesource.com/nexus/content/repositories/releases</url> <snapshots> <enabled>false</enabled> </snapshots> <releases> <enabled>true</enabled> </releases> </repository> <repository> <id>snapshot.fusesource.org</id> <name>FuseSource Snapshot Repository</name> <url>http://repo.fusesource.com/nexus/content/repositories/snapshots</url> <snapshots> <enabled>true</enabled> </snapshots> <releases> <enabled>false</enabled> </releases> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>release.fusesource.org</id> <name>FuseSource Release Repository</name> <url>http://repo.fusesource.com/nexus/content/repositories/releases</url> <snapshots> <enabled>false</enabled> </snapshots> <releases> <enabled>true</enabled> </releases> </pluginRepository> <pluginRepository> <id>snapshot.fusesource.org</id> <name>FuseSource Snapshot Repository</name> <url>http://repo.fusesource.com/nexus/content/repositories/snapshots</url> <snapshots> <enabled>true</enabled> </snapshots> <releases> <enabled>false</enabled> </releases> </pluginRepository> </pluginRepositories> <dependencies> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-api</artifactId> <version>2.7.11</version> </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-cxf</artifactId> <version>2.13.1</version> </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-core</artifactId> <version>2.13.0</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-transports-http-jetty</artifactId> <version>2.6.1</version> </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-spring</artifactId> <version>2.13.0</version> </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-jaxb</artifactId> <version>2.13.0</version> </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-bindy</artifactId> <version>2.13.0</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.6.6</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.6.6</version> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.17</version> </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-test-spring</artifactId> <version>2.13.0</version> <scope>test</scope> </dependency> </dependencies> <build> <defaultGoal>install</defaultGoal> <plugins> <plugin> <groupId>org.apache.cxf</groupId> <artifactId>cxf-codegen-plugin</artifactId> <version>3.0.0</version> <executions> <execution> <id>generate-sources</id> <phase>generate-sources</phase> <configuration> <sourceRoot>${project.build.directory}/generatedsources</sourceRoot> <wsdlOptions> <wsdlOption> <wsdl>${basedir}/src/main/resources/META-INF/WSDL/CustomDetails.wsdl</wsdl> </wsdlOption> </wsdlOptions> </configuration> <goals> <goal>wsdl2java</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <extensions>true</extensions> <configuration> <instructions> <Export-Package> !com.mrbool.ws.HelloWorld </Export-Package> <Import-Package> META-INF.cxf, * </Import-Package> <DynamicImport-Package> org.apache.cxf.*, org.springframework.beans.* </DynamicImport-Package> </instructions> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.5.1</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>2.4.3</version> <configuration> <encoding>UTF-8</encoding> </configuration> </plugin> <plugin> <groupId>org.apache.camel</groupId> <artifactId>camel-maven-plugin</artifactId> <version>2.13.0</version> </plugin> </plugins> </build> </project> Error Message: [pache.camel.spring.Main.main()] ReflectionServiceFactoryBean INFO Creating Service {http://webservice.com}getHelloWorldMessage from class com.webservice.CustomerMethod [ERROR] ************************************* [ERROR] Error occurred while running main from: org.apache.camel.spring.Main [ERROR] java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.apache.camel.maven.RunMojo$1.run(RunMojo.java:488) at java.lang.Thread.run(Thread.java:722) Caused by: java.lang.IllegalAccessError: tried to access method org.apache.cxf.service.factory.ReflectionServiceFactoryBean.getMethodDispatcher()Lorg/apache/cxf/service/invoker/MethodDispatcher; from class org.apache.cxf.frontend.AbstractWSDLBasedEnd pointFactory at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createBindingInfo(AbstractWSDLBasedEndpointFactory.java:346) at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpointInfo(AbstractWSDLBasedEndpointFactory.java:259) 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:117) 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.util.ServiceHelper.startService(ServiceHelper.java:74) at org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:407) at org.apache.camel.impl.ProducerCache.acquireProducer(ProducerCache.java:123) at org.apache.camel.processor.SendProcessor.doStart(SendProcessor.java:202) 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.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:79) at org.apache.camel.processor.interceptor.TraceInterceptor.doStart(TraceInterceptor.java:358) 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:1154) at org.apache.camel.support.ChildServiceSupport.start(ChildServiceSupport.java:41) at org.apache.camel.support.ChildServiceSupport.start(ChildServiceSupport.java:28) 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:993) 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:329) at org.apache.camel.impl.RouteService.warmUp(RouteService.java:158) at org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:2236) at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:2166) at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1954) at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1826) at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1665) at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1633) at org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:254) at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:120) at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:316) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:96) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334) at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:948) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93) at org.apache.camel.spring.Main.createDefaultApplicationContext(Main.java:187) at org.apache.camel.spring.Main.doStart(Main.java:141) at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) at org.apache.camel.main.MainSupport.run(MainSupport.java:148) at org.apache.camel.main.MainSupport.run(MainSupport.java:352) at org.apache.camel.spring.Main.main(Main.java:74) ... 6 more [ERROR] ************************************* [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1:23.447s [INFO] Finished at: Thu Jun 19 10:19:25 IST 2014 [INFO] Final Memory: 18M/45M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.camel:camel-maven-plugin:2.13.0:run (default-cli) on project WebserviceConsume: null: MojoExecutionException: InvocationTargetException: tried to access method org.apache.cxf.service.factory.ReflectionService FactoryBean.getMethodDispatcher()Lorg/apache/cxf/service/invoker/MethodDispatcher; from class org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException -- View this message in context: http://camel.465427.n5.nabble.com/Consume-CXF-Web-service-using-setHeader-or-anyway-without-using-JAVA-code-Error-tp5752535.html Sent from the Camel - Users mailing list archive at Nabble.com.