You can enable logging in the AHC library by setting the appropriate log
categories to DEBUG or TRACE level in your log stack configuration.

This will show what AHC is actually sending to the backend.

If you are using AHC 1.8.x, the logging category to enable is com.ning.http.

It could happen that the payload is being sent, but along with some
additional HTTP request headers which may confuse the backend
(Content-Type, Content-Length, etc.).

Regards,

*Raúl Kripalani*
Apache Camel PMC Member & Committer | Enterprise Architect, Open Source
Integration specialist
http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
http://blog.raulkr.net | twitter: @raulvk

On Wed, Aug 20, 2014 at 9:15 AM, Jaume Sancho <[email protected]> wrote:

> Hi Claus,
>
> It does sound a lot like that, but unfortunately that didn't work either.
>
> from("servlet:///tinyproxy")
> .streamCaching()
> //.log("${body}")
> .to("ahc:
>
> http://localhost/api/servers?bridgeEndpoint=true&throwExceptionOnFailure=false
> ");
>
> When the log is enabled I do actually see the body in the console output,
> but it's still not received the by the server at other end.
> I also tried removing the "log" call, in case it could have been consuming
> the stream, but same result.
>
> Any other suggestions?
>
>
> Thanks very much, I really appreciate you taking the time to answer such
> beginner questions.
>
> Jaume
>
>
>
>
> On 19 August 2014 19:02, Claus Ibsen <[email protected]> wrote:
>
> > Hi
> >
> > Sounds a bit like this
> > http://camel.apache.org/why-is-my-message-body-empty.html
> >
> > On Tue, Aug 19, 2014 at 6:11 PM, Jaume Sancho <[email protected]> wrote:
> > > Hi,
> > >
> > > I am in the process of creating a Camel-based proxy that takes in
> > requests
> > > on a Tomcat Servlet, does some internal processing, and ultimately
> > returns
> > > the responses that you would expect when accessing the targeted server
> > > itself.
> > >
> > > In its simplest implementation this works just fine for GET and DELETE
> > > requests.
> > >
> > > from("servlet:///tinyproxy")
> > > .log("${body}")
> > > .to("ahc:
> > >
> >
> http://localhost/api/servers?bridgeEndpoint=true&throwExceptionOnFailure=false
> > > ");
> > >
> > > However, when I try to do the same with an AHC component, the body* of
> > POST
> > > and PUT requests is not being received at the other end.
> > >
> > > If I change the module to http4, the body of the request is received,
> and
> > > the appropriate response is forwarded back to the sender.
> > >
> > > from("servlet:///tinyproxy2")
> > > .log("${body}")
> > >
> >
> .to("http4:localhost/api/servers?bridgeEndpoint=true&throwExceptionOnFailure=false");
> > >
> > > The log message does actually print the body as it is provided by the
> > > original request, so that should confirm that the setup of Camel/Tomcat
> > > should be OK.
> > >
> > > *Here are some very simple examples of request bodies that fail to be
> > > passed through when using AHC.
> > >
> > > JSON: (using single quotes to avoid parsing issues with Camel)
> > > {'HostName':'DEVSERVER'}
> > >
> > > XML:
> > > <ServerDetails xmlns:i="http://www.w3.org/2001/XMLSchema-instance";
> > xmlns="
> > > http://schemas.datacontract.org/2004/07/HttpTests.Models";>
> > > <HostName>DEVServer</HostName>
> > > </ServerDetails>
> > >
> > > This is occurring with the version 2.13.2 of all components:
> camel-core,
> > > camel-servletlistener, camel-http4, camel-ahc
> > > I'm sending the http requests with Curl.
> > >
> > > Could I be missing something entirely obvious?
> > >
> > >
> > > Thanks,
> > >
> > > Jaume
> >
> >
> >
> > --
> > Claus Ibsen
> > -----------------
> > Red Hat, Inc.
> > Email: [email protected]
> > Twitter: davsclaus
> > Blog: http://davsclaus.com
> > Author of Camel in Action: http://www.manning.com/ibsen
> > hawtio: http://hawt.io/
> > fabric8: http://fabric8.io/
> >
>

Reply via email to