You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Nesrine Besbes <ne...@gmail.com> on 2017/04/12 02:19:56 UTC

not connected to rest api with apache camel

Hi ,
How can I connect to distant rest api feg(
https://jsonplaceholder.typicode.com/posts/)
using apache camel , I tried component http ,rest , restlet but always I
had errors like
"Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/camel/component/http/CamelServlet"
and not consumed from http component : my code is :

  //  from("jetty:
https://jsonplaceholder.typicode.com/post/?httpMethodRestrict=GET")
// from("restlet:
https://jsonplaceholder.typicode.com/posts/?restletMethods=get")

 from("rest:get:https://jsonplaceholder.typicode.com/posts/")
   // .setHeader(Exchange.HTTP_METHOD, constant("GET"))
   . log("connected!!").

toD("mongodb:mongobean?database=${header.Client1}&collection=${header.ressource}&dynamicity=true&operation=insert");

Best regards

Re: not connected to rest api with apache camel

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Please use the user @user mailing list / user forum - not this one

On Wed, Apr 12, 2017 at 4:19 AM, Nesrine Besbes
<ne...@gmail.com> wrote:
> Hi ,
> How can I connect to distant rest api feg(
> https://jsonplaceholder.typicode.com/posts/)
> using apache camel , I tried component http ,rest , restlet but always I
> had errors like
> "Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/camel/component/http/CamelServlet"
> and not consumed from http component : my code is :
>
>   //  from("jetty:
> https://jsonplaceholder.typicode.com/post/?httpMethodRestrict=GET")
> // from("restlet:
> https://jsonplaceholder.typicode.com/posts/?restletMethods=get")
>
>  from("rest:get:https://jsonplaceholder.typicode.com/posts/")
>    // .setHeader(Exchange.HTTP_METHOD, constant("GET"))
>    . log("connected!!").
>
> toD("mongodb:mongobean?database=${header.Client1}&collection=${header.ressource}&dynamicity=true&operation=insert");
>
> Best regards



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2