camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hadrian Zbarcea <hzbar...@gmail.com>
Subject Re: AW: Call Web Services from Camel
Date Thu, 27 Dec 2007 21:09:00 GMT
Hi Robert,

 From what you describe, it looks like you just need to call your web 
services normally

from(...)
.to(webservice 1)
.to(webservice 2)
.to(resultQueue);

You must have the cxf component and your urls have to point to cxf web 
services.  Taking a look at camel-example-cxf may help.

Hadrian

Robert Thullner wrote:
> Thanks for the reply.
>
> I looked at both components, but I still have some understanding problems.
> My problem is that I do not know how to trigger the webservice call from
> camel.
> Usually I have a rule:
>
> from(...)
> .to(...); 
>
> So I wait for an event and write the event to somewhere else.
>
> My scenario is something like that.
> from(...)
> .call(webservice 1)
> .call(webservice 2)
> .to(resultQueue);
>
> Do you have any tutorials for calling a service within a route? Or should it
> be implemented somehow else?
>
>
>
> I also tried to get request from a REST webservice and write it the result
> to a queue, as the service is called from the browser window. I used the
> jetty component for this, as the HttpComponent cannot be used as input
> component.
>
> My route looks like this:
> from("jetty:http:localhost:8080/restapp-1.0.0/helloworld")
> .to("activemq:queue:rest.queue");
>
> But when I start the CamelContext I always get an exception (see below). I
> have put the camel-http, camel-jetty, jetty, jetty-util and jetty-xbean jars
> on my classpath, but there are still some classes missing. But I could not
> find any jar file that includes the HttpClient class. What other jar files
> do I need to get the JettyComponent working?
>
>
> The exception is:
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/mortbay/jetty/client/HttpClient
> at
> org.apache.camel.component.jetty.JettyHttpComponent.createHttpClient(JettyHt
> tpComponent.java:193)
> at
> org.apache.camel.component.jetty.JettyHttpComponent.doStart(JettyHttpCompone
> nt.java:187)
> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:51)
> at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:42)
> at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:53)
> at
> org.apache.camel.impl.DefaultCamelContext.getComponent(DefaultCamelContext.j
> ava:149)
> at
> org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.ja
> va:256)
> at
> org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHe
> lper.java:48)
> at org.apache.camel.model.RouteType.resolveEndpoint(RouteType.java:89)
> at org.apache.camel.impl.RouteContext.resolveEndpoint(RouteContext.java:81)
> at org.apache.camel.impl.RouteContext.resolveEndpoint(RouteContext.java:90)
> at org.apache.camel.model.FromType.resolveEndpoint(FromType.java:66)
> at org.apache.camel.impl.RouteContext.getEndpoint(RouteContext.java:59)
> at org.apache.camel.model.RouteType.addRoutes(RouteType.java:179)
> at org.apache.camel.model.RouteType.addRoutes(RouteType.java:80)
> at org.apache.camel.model.RouteType.addRoutes(RouteType.java:71)
> at
> org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamel
> Context.java:449)
> at
> org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:4
> 41)
> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:51)
> at eip.status.camel.routes.MessageBroker.main(MessageBroker.java:93)
>  
>
> Thanks for help
> Robert
>
> -----Urspr√ľngliche Nachricht-----
> Von: Guillaume Nodet [mailto:gnodet@gmail.com] 
> Gesendet: Donnerstag, 27. Dezember 2007 17:04
> An: camel-user@activemq.apache.org
> Betreff: Re: Call Web Services from Camel
>
> There is a CXF based component that you should be able to use it provided
> that you configure it correctly for REST.  Else, if you have problems to do
> that using the HTTP component, let us know, as it should be able to work
> too.
>
> On Dec 27, 2007 3:45 PM, Robert Thullner <rthullner@gmx.at> wrote:
>
>   
>> Hi
>>
>> Is it possible to invoke Web Services within my CamelContext? 
>> Especially I want to invoke a REST service and a service implemented in
>>     
> CXF or Axis.
>   
>> My scenario is the following: When a jms message is received on a 
>> queue, the REST service and the Axis service shall be invoked and the 
>> results of the two services shall be passed back on some other queue?
>> Can this be done by using the Camel HTTP component or is it advisable 
>> to just implement the Webservice calling in some Java class?
>> For me it would be a nice architecture if I could do the web service 
>> calling in my camel context, so I could get it out of my Java classes. 
>> So my question is if that can be done when using Camel?
>>
>> Thanks for any suggestions
>> Robert
>>
>>     
>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
>
>
>   

Mime
View raw message