Hi See these links also http://camel.apache.org/using-getin-or-getout-methods-on-exchange.html http://camel.apache.org/pipes-and-filters.html http://camel.apache.org/how-do-i-enable-streams-when-debug-logging-messages-in-camel.html http://camel.apache.org/stream-caching.html
On Fri, Oct 26, 2012 at 6:21 PM, Cyril Lakech <cyril.lak...@adeoservices.com> wrote: > Hi, > > I am trying to call a remote http service to retrieve a message using http4 > component. > > I would like to understand the sentence from the http4 component web page > http://camel.apache.org/http4.html > > "Camel will store the HTTP response from the external server on the OUT > body. All headers from the IN message will be copied to the OUT message, so > headers are preserved during routing. Additionally Camel will add the HTTP > response headers as well to the OUT message headers." > > But exchange.getOut() is null after a http4 call and the result seems to be > present in the exchange.getInt() body... > > to("http4://myURI").// > process(new Processor() { > @Override > public void process(Exchange exchange) throws Exception > { > log.info(exchange.getOut().getBody().toString()); > ==> NPE > } > }) > > And last, how do I can read the body and convert it into a String ? The > body seems to be an instance of CachedOutputStream. How should I read this ? > > I looked to convertBodyTo camel method but can't find any elegant solution > to transform my CachedOutputStream into a String. > > Regards, > > Cyril Lakech > > -- > Ce message et toutes les pièces jointes sont établis à l'attention > exclusive de leurs destinataires et sont confidentiels. Si vous recevez ce > message par erreur, merci de le détruire et d'en avertir immédiatement > l'expéditeur. L'internet ne permettant pas d'assurer l'intégrité de ce > message, le contenu de ce message ne représente en aucun cas un engagement > de la part de GROUPE ADEO. -- Claus Ibsen ----------------- Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen