You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by pvunckx <pi...@telenet.be> on 2012/03/02 10:34:01 UTC

Call external webservice

Hi,

I'm stuck with some basic functionality...
I'm trying to call an external webservice 
This is what I'm doing:

CamelContext context = new DefaultCamelContext();
		
try {
  RouteBuilder builder = new RouteBuilder(){
    @Override
    public void configure() throws Exception {
      String endPointTo = "";
      endPointTo +=
"cxf://http://localhost:7101/KenE-CMService-context-root/CMServicePort?";
      endPointTo += "wsdlURL=src/main/wsdl/cmservice.wsdl&";
      endPointTo += "serviceName={http://service.axi.be/}CMService&";
      endPointTo += "portName={http://service.axi.be/}CMServicePort&";
      endPointTo += "serviceClass=be.axi.service.CMService&";
      endPointTo += "dataFormat=PAYLOAD";
					
      from ("file:data/inboxsoap?noop=true").
      to("stream:out").to(endPointTo);

   }
};
			
context.addRoutes(builder);

When I'm running the application I'm getting the following exception (and my
webservice is not reached).

10:06:29.503 [Camel (camel-1) thread #1 - file://data/inboxsoap] DEBUG
o.a.camel.processor.SendProcessor - >>>>
Endpoint[cxf://http://localhost:7101/KenE-CMService-context-root/CMServicePort?dataFormat=PAYLOAD&portName=%7Bhttp://service.axi.be/%7DCMServicePort&serviceClass=be.axi.service.CMService&serviceName=%7Bhttp://service.axi.be/%7DCMService&wsdlURL=src/main/wsdl/cmservice.wsdl]
Exchange[message1.xml]
10:06:29.513 [Camel (camel-1) thread #1 - file://data/inboxsoap] DEBUG
o.a.camel.component.cxf.CxfProducer - Try to find a default operation. You
should set 'operationName' in header.
10:06:29.513 [Camel (camel-1) thread #1 - file://data/inboxsoap] DEBUG
o.a.c.c.cxf.DefaultCxfBinding - Propagate to CXF header: breadcrumbId value:
ID-AB00W363-54301-1330679186507-0-2
10:06:29.523 [Camel (camel-1) thread #1 - file://data/inboxsoap] DEBUG
o.a.c.processor.DefaultErrorHandler - Failed delivery for exchangeId:
ID-AB00W363-54301-1330679186507-0-1. On delivery attempt: 0 caught:
org.apache.camel.CamelExecutionException: Exception occurred during
execution on the exchange: Exchange[message1.xml]
10:06:29.523 [Camel (camel-1) thread #1 - file://data/inboxsoap] ERROR
o.a.c.processor.DefaultErrorHandler - Failed delivery for exchangeId:
ID-AB00W363-54301-1330679186507-0-1. Exhausted after delivery attempt: 1
caught: org.apache.camel.CamelExecutionException: Exception occurred during
execution on the exchange: Exchange[message1.xml]
org.apache.camel.CamelExecutionException: Exception occurred during
execution on the exchange: Exchange[message1.xml]
	at
org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1212)
~[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.impl.DefaultExchange.setException(DefaultExchange.java:282)
~[camel-core-2.9.0.jar:2.9.0]
	at org.apache.camel.component.cxf.CxfProducer.process(CxfProducer.java:105)
~[camel-cxf-2.9.0.jar:2.9.0]
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:115)
~[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:285)
~[camel-core-2.9.0.jar:2.9.0]
	at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:110)
~[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)
[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91)
~[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:322)
[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:213)
[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)
[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
[camel-core-2.9.0.jar:2.9.0]
	at org.apache.camel.processor.Pipeline.process(Pipeline.java:117)
[camel-core-2.9.0.jar:2.9.0]
	at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)
[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)
[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)
[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:352)
[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:175)
[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:136)
[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:140)
[camel-core-2.9.0.jar:2.9.0]
	at
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:92)
[camel-core-2.9.0.jar:2.9.0]
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
[na:1.6.0_20]
	at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source)
[na:1.6.0_20]
	at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
[na:1.6.0_20]
	at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(Unknown
Source) [na:1.6.0_20]
	at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(Unknown
Source) [na:1.6.0_20]
	at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown
Source) [na:1.6.0_20]
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
[na:1.6.0_20]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[na:1.6.0_20]
	at java.lang.Thread.run(Unknown Source) [na:1.6.0_20]
Caused by: java.lang.NoSuchMethodError:
org.apache.cxf.endpoint.Client.invoke(Lorg/apache/cxf/endpoint/ClientCallback;Lorg/apache/cxf/service/model/BindingOperationInfo;[Ljava/lang/Object;Ljava/util/Map;Lorg/apache/cxf/message/Exchange;)V
	at org.apache.camel.component.cxf.CxfProducer.process(CxfProducer.java:97)
~[camel-cxf-2.9.0.jar:2.9.0]
	... 43 common frames omitted
10:06:29.533 [Camel (camel-1) thread #1 - file://data/inboxsoap] DEBUG
org.apache.camel.processor.Pipeline - Message exchange has failed: so
breaking out of pipeline for exchange: Exchange[message1.xml] Exception:
org.apache.camel.CamelExecutionException: Exception occurred during
execution on the exchange: Exchange[message1.xml]
10:06:29.533 [Camel (camel-1) thread #1 - file://data/inboxsoap] DEBUG
o.a.c.c.file.GenericFileOnCompletion - Done processing file:
GenericFile[message1.xml] using exchange: Exchange[message1.xml]

Thanks for your advise !

Pieter











--
View this message in context: http://camel.465427.n5.nabble.com/Call-external-webservice-tp5530473p5530473.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Call external webservice

Posted by Claus Ibsen <cl...@gmail.com>.
You get some kind a NoSuchMethodError exception.
Which version of CXF are you using? And make sure you do not have
mixed versions of the JARs on the classpath.

You need to use CXF 2.5.1 or the 2.5.2 ought to work as well for Camel 2.9.0.


On Fri, Mar 2, 2012 at 10:34 AM, pvunckx <pi...@telenet.be> wrote:
> Hi,
>
> I'm stuck with some basic functionality...
> I'm trying to call an external webservice
> This is what I'm doing:
>
> CamelContext context = new DefaultCamelContext();
>
> try {
>  RouteBuilder builder = new RouteBuilder(){
>    @Override
>    public void configure() throws Exception {
>      String endPointTo = "";
>      endPointTo +=
> "cxf://http://localhost:7101/KenE-CMService-context-root/CMServicePort?";
>      endPointTo += "wsdlURL=src/main/wsdl/cmservice.wsdl&";
>      endPointTo += "serviceName={http://service.axi.be/}CMService&";
>      endPointTo += "portName={http://service.axi.be/}CMServicePort&";
>      endPointTo += "serviceClass=be.axi.service.CMService&";
>      endPointTo += "dataFormat=PAYLOAD";
>
>      from ("file:data/inboxsoap?noop=true").
>      to("stream:out").to(endPointTo);
>
>   }
> };
>
> context.addRoutes(builder);
>
> When I'm running the application I'm getting the following exception (and my
> webservice is not reached).
>
> 10:06:29.503 [Camel (camel-1) thread #1 - file://data/inboxsoap] DEBUG
> o.a.camel.processor.SendProcessor - >>>>
> Endpoint[cxf://http://localhost:7101/KenE-CMService-context-root/CMServicePort?dataFormat=PAYLOAD&portName=%7Bhttp://service.axi.be/%7DCMServicePort&serviceClass=be.axi.service.CMService&serviceName=%7Bhttp://service.axi.be/%7DCMService&wsdlURL=src/main/wsdl/cmservice.wsdl]
> Exchange[message1.xml]
> 10:06:29.513 [Camel (camel-1) thread #1 - file://data/inboxsoap] DEBUG
> o.a.camel.component.cxf.CxfProducer - Try to find a default operation. You
> should set 'operationName' in header.
> 10:06:29.513 [Camel (camel-1) thread #1 - file://data/inboxsoap] DEBUG
> o.a.c.c.cxf.DefaultCxfBinding - Propagate to CXF header: breadcrumbId value:
> ID-AB00W363-54301-1330679186507-0-2
> 10:06:29.523 [Camel (camel-1) thread #1 - file://data/inboxsoap] DEBUG
> o.a.c.processor.DefaultErrorHandler - Failed delivery for exchangeId:
> ID-AB00W363-54301-1330679186507-0-1. On delivery attempt: 0 caught:
> org.apache.camel.CamelExecutionException: Exception occurred during
> execution on the exchange: Exchange[message1.xml]
> 10:06:29.523 [Camel (camel-1) thread #1 - file://data/inboxsoap] ERROR
> o.a.c.processor.DefaultErrorHandler - Failed delivery for exchangeId:
> ID-AB00W363-54301-1330679186507-0-1. Exhausted after delivery attempt: 1
> caught: org.apache.camel.CamelExecutionException: Exception occurred during
> execution on the exchange: Exchange[message1.xml]
> org.apache.camel.CamelExecutionException: Exception occurred during
> execution on the exchange: Exchange[message1.xml]
>        at
> org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1212)
> ~[camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.impl.DefaultExchange.setException(DefaultExchange.java:282)
> ~[camel-core-2.9.0.jar:2.9.0]
>        at org.apache.camel.component.cxf.CxfProducer.process(CxfProducer.java:105)
> ~[camel-cxf-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> [camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:115)
> ~[camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:285)
> ~[camel-core-2.9.0.jar:2.9.0]
>        at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:110)
> ~[camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> [camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
> [camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> [camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)
> [camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> [camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
> [camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> [camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91)
> ~[camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> [camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:322)
> [camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:213)
> [camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
> [camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> [camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)
> [camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> [camel-core-2.9.0.jar:2.9.0]
>        at org.apache.camel.processor.Pipeline.process(Pipeline.java:117)
> [camel-core-2.9.0.jar:2.9.0]
>        at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
> [camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
> [camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> [camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)
> [camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)
> [camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> [camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
> [camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> [camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)
> [camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:352)
> [camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:175)
> [camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:136)
> [camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:140)
> [camel-core-2.9.0.jar:2.9.0]
>        at
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:92)
> [camel-core-2.9.0.jar:2.9.0]
>        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
> [na:1.6.0_20]
>        at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source)
> [na:1.6.0_20]
>        at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
> [na:1.6.0_20]
>        at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(Unknown
> Source) [na:1.6.0_20]
>        at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(Unknown
> Source) [na:1.6.0_20]
>        at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown
> Source) [na:1.6.0_20]
>        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
> [na:1.6.0_20]
>        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
> [na:1.6.0_20]
>        at java.lang.Thread.run(Unknown Source) [na:1.6.0_20]
> Caused by: java.lang.NoSuchMethodError:
> org.apache.cxf.endpoint.Client.invoke(Lorg/apache/cxf/endpoint/ClientCallback;Lorg/apache/cxf/service/model/BindingOperationInfo;[Ljava/lang/Object;Ljava/util/Map;Lorg/apache/cxf/message/Exchange;)V
>        at org.apache.camel.component.cxf.CxfProducer.process(CxfProducer.java:97)
> ~[camel-cxf-2.9.0.jar:2.9.0]
>        ... 43 common frames omitted
> 10:06:29.533 [Camel (camel-1) thread #1 - file://data/inboxsoap] DEBUG
> org.apache.camel.processor.Pipeline - Message exchange has failed: so
> breaking out of pipeline for exchange: Exchange[message1.xml] Exception:
> org.apache.camel.CamelExecutionException: Exception occurred during
> execution on the exchange: Exchange[message1.xml]
> 10:06:29.533 [Camel (camel-1) thread #1 - file://data/inboxsoap] DEBUG
> o.a.c.c.file.GenericFileOnCompletion - Done processing file:
> GenericFile[message1.xml] using exchange: Exchange[message1.xml]
>
> Thanks for your advise !
>
> Pieter
>
>
>
>
>
>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Call-external-webservice-tp5530473p5530473.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/