camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: AHC module not passing the request body
Date Tue, 19 Aug 2014 18:02:12 GMT
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 <j@ume.me.uk> 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: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Mime
View raw message