Your syntax is not correct as umarshalling of a jackson stream (coming from the HTTP request) will return a HashMap. To access to this value using the simple language, this syntax has to be used : simple("${body[code]}")
Example : <route streamCache="true"> <from uri=" http://gateway.marvel.com/v1/public/comics?dateDescriptor=nextWeek&ts=987&apikey=97f295907072a970c5df30d73d1f3816&hash=abfa1c1d42a73a5eab042242335d805d "/> <log message=">> Response received : ${body}"/> <unmarshal> <json library="Jackson"/> </unmarshal> <log message="Attribute code : ${body[code]}"/> <log message="Attribute status : ${body[status]}"/> <log message="Attribute stacopyrighttus : ${body[copyright]}"/> <log message="Attribute title : ${body[title]}"/> </route> On Mon, Oct 27, 2014 at 11:47 AM, Charles Moulliard <ch0...@gmail.com> wrote: > You syntax is not correct as unmarshalling of jackson will return > > On Mon, Oct 27, 2014 at 10:56 AM, Jonathan Vila Lopez < > jonathan.v...@gmail.com> wrote: > >> Hi Charles >> >> Oki, thank you. >> >> But, how can I retrieve 3 attributes from the JSON and print out them ? >> In the line 3 I get nothing in the console, so it seems line 2 in wrong in >> some way.... >> >> 1. >> unmarshal().json(JsonLibrary.Jackson). >> 2. setBody(simple("my attributes are : ${body?.code?}")). >> 3. to("stream:out"); >> >> Kind regards. >> >> >> [image: Inline image 2] >> >> * Jonathan Vila ** <https://www.twitter.com/jonathan_vila> >> <http://www.linkedin.com/in/jonathanvila>* >> >> >> * jonathan.v...@gmail.com <jonathan.v...@gmail.com>* >> >> >> >> >> On Mon, Oct 27, 2014 at 10:48 AM, Charles Moulliard <ch0...@gmail.com> >> wrote: >> >>> Hi Jonathan, >>> >>> Our documentation is not longer up to date as now the http component >>> proposes / provides also a HttpConsumer (= Polling Consumer) which is >>> able >>> every x second to do a HTTP request. So, you can also use this syntax >>> within your Apache Camel route (from("http://").to("") to poll a HTTP >>> Server. >>> >>> Regards, >>> >>> On Mon, Oct 27, 2014 at 9:48 AM, Jonathan Vila Lopez < >>> jonathan.v...@gmail.com> wrote: >>> >>> > Hello Charles >>> > >>> > But, with that code I used I successfully get the response and >>> > successfully unmarshals it...... in fact, in my code my problem was in >>> the >>> > line of setBody.... I can not get the attributes. >>> > >>> > Anyway I will try your proposal. >>> > >>> > Kind regards. >>> > >>> > >>> > [image: Inline image 2] >>> > >>> > * Jonathan Vila ** <https://www.twitter.com/jonathan_vila> >>> > <http://www.linkedin.com/in/jonathanvila>* >>> > >>> > >>> > * jonathan.v...@gmail.com <jonathan.v...@gmail.com>* >>> > >>> > >>> > >>> > >>> > On Mon, Oct 27, 2014 at 8:57 AM, Charles Moulliard <ch0...@gmail.com> >>> > wrote: >>> > >>> >> Hi Jonathan, >>> >> >>> >> To call the HTTP Server exposing the REST service the HTTP producer >>> must >>> >> be >>> >> used and not the HTTP Consumer component of Camel ( >>> >> http://camel.apache.org/http.html). This syntax is not correct >>> >> (from("http://") while this one is correct >>> >> >>> >> from("direct:marvel").to(" >>> >> >>> >> >>> http://gateway.marvel.com:80/v1/public/comics?dateDescriptor=nextWeek&ts=987&apikey=97f295907072a970c5df30d73d1f3816&hash=abfa1c1d42a73a5eab042242335d805d >>> >> "). >>> >> >>> >>> unmarshal().json(JsonLibrary.Jackson). >>> >> setBody(simple("my attributes are : ${body?.code?}")). >>> >> to("stream:out"); >>> >> >>> >> Regards, >>> >> >>> > >>> > >>> >>> >>> -- >>> Charles Moulliard >>> Apache Committer / Architect @RedHat >>> Twitter : @cmoulliard | Blog : http://cmoulliard.github.io >>> >> >> > > > -- > Charles Moulliard > Apache Committer / Architect @RedHat > Twitter : @cmoulliard | Blog : http://cmoulliard.github.io > > -- Charles Moulliard Apache Committer / Architect @RedHat Twitter : @cmoulliard | Blog : http://cmoulliard.github.io