Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1CB28113F3 for ; Wed, 20 Aug 2014 13:21:48 +0000 (UTC) Received: (qmail 6897 invoked by uid 500); 20 Aug 2014 13:21:47 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 6854 invoked by uid 500); 20 Aug 2014 13:21:47 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 6838 invoked by uid 99); 20 Aug 2014 13:21:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Aug 2014 13:21:47 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of raul@evosent.com designates 209.85.192.179 as permitted sender) Received: from [209.85.192.179] (HELO mail-pd0-f179.google.com) (209.85.192.179) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Aug 2014 13:21:18 +0000 Received: by mail-pd0-f179.google.com with SMTP id v10so11938260pde.38 for ; Wed, 20 Aug 2014 06:21:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=OK6n6THrzwtSdQrdGAenqId2NkUV/SFYL/1EBCp3Kzg=; b=Vb5crGL49eFir9l6HHqWN2aS3+YwpV6s/akDGkZl9EW2borWSfhOVD0VHD8RfWdzx+ hFNXlXceTUn00SZ0sA7uR5ykGUhrnDBhc5qO6rbkdaDEMggbaK/1bgXi2fKErkamBnCF B0nva2ajNTcfG3PA/h4yyJ2wEVXBU1YZnuRfmH3g6hzIFIU09cqV2zdybl+u4W7N7ZMv SP+CF4nC+B9g3pHQT1ueKXdXgfdVON3cZzXTpBRUMX1Wc7m7p0dhLGICj4Q+xsmkzlRy gAnVD4mPtlD9qsJkOgnFGtpQ+Wc64wvK9FjyLzQs07wR61XLbh0pnqfdROKJmtk1HEvv O0wA== X-Gm-Message-State: ALoCoQlgfCVwFU2GwDfOmJbXh1Hcoys5RE/Fm+/pbAoVyhKFy942Dpc24FGfxus+5wIG303lOGxe X-Received: by 10.70.36.4 with SMTP id m4mr58521489pdj.88.1408540871810; Wed, 20 Aug 2014 06:21:11 -0700 (PDT) MIME-Version: 1.0 Received: by 10.70.103.141 with HTTP; Wed, 20 Aug 2014 06:20:50 -0700 (PDT) X-Originating-IP: [85.155.64.198] In-Reply-To: References: From: Raul Kripalani Date: Wed, 20 Aug 2014 14:20:50 +0100 Message-ID: Subject: Re: AHC module not passing the request body To: "users@camel.apache.org" Content-Type: multipart/alternative; boundary=089e0103de5c50f3c505010f7a85 X-Virus-Checked: Checked by ClamAV on apache.org --089e0103de5c50f3c505010f7a85 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Jaume, Did you enable the TRACE level for the com.ning.http logging category? I see no output from the async-http-client, just from the camel-ahc component. To continue with the diagnosis, can you try to use the convertBodyTo(String.class) DSL before sending to your AHC endpoint? I can see from the output that Camel has detected the payload to be an InputStream and has used the InputStreamBodyGenerator of AHC. At least that's correct. That class logs on the "com.ning.http.client.generators.InputStreamBodyGenerator" category, so I'm quite keen to see the logging output. Thanks, *Ra=C3=BAl 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 12:27 PM, Jaume Sancho wrote: > Hi Raul, > > To start off I have inspected the headers received at the target server, > and the only difference between AHC and Http4, was that AHC enabled > compression by default. > So I have set that up via "clientConfig.compressionEnabled=3Dtrue" and I = can > confirm that the headers now match line-by-line. > However, I'm still obtaining the same result, the body is not received at > the target server when using AHC. > > Moving on from that, I have set the logger to TRACE for both components a= nd > compared the results (full AHC trace at the bottom of this email) > > Some thoughts from the trace > > - [http-bio-8080-exec-13] DefaultStreamCachingStrategy DEBUG Should spo= ol > cache 98 -> false > 98 is the length of the JSON payload that I'm sending > > - [http-bio-8080-exec-13] route4 INFO > > {'HostName':'DEVSERVER','IpAddress':'192.168.1.42','x64':true,'Operating= System':'Windows > Host'} > this is the explicit call to log that I make with the ${body} content > > - These traced calls would lead me to believe that the AHC is at lest > attempting to parse the content > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Converting > org.apache.camel.converter.stream.InputStreamCache -> > com.ning.http.client.BodyGenerator with value: > org.apache.camel.converter.stream.InputStreamCache@4ee3990b > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Converting > org.apache.camel.component.http.HttpMessage -> > com.ning.http.client.BodyGenerator with value: Message: [Body is instance > of org.apache.camel.StreamCache] > [http-bio-8080-exec-13] DefaultAhcBinding TRACE Setting body > com.ning.http.client.generators.InputStreamBodyGenerator@7255cf3f > [http-bio-8080-exec-13] DefaultAhcBinding TRACE Setting > Content-Type application/json > > I am also using 2.13.2 for camel-core and AHC, would you recommend to > attempt this with any other versions of the library? > Or should I maybe consider debugging AHC to see what happens internally? > > Any other ideas to share? > > Thanks, > > Jaume > > > ps: here's the full trace. > > [http-bio-8080-exec-13] CamelHttpTransportServlet TRACE Service: > org.apache.catalina.connector.RequestFacade@40bbc1f6 > [http-bio-8080-exec-13] DefaultHttpBinding TRACE readRequest > org.apache.catalina.connector.RequestFacade@40bbc1f6 > [http-bio-8080-exec-13] IOHelper TRACE Copying > InputStream: org.apache.catalina.connector.CoyoteInputStream@4a0cc3e8 -> > OutputStream: CachedOutputStream[size: 0] with buffer: 4096 and flush on > each write false > [http-bio-8080-exec-13] DefaultStreamCachingStrategy DEBUG Should spool > cache 98 -> false > [http-bio-8080-exec-13] DefaultHttpBinding TRACE HTTP paramet= er > address =3D [localhost:58100/api/servers] > [http-bio-8080-exec-13] DefaultHttpBinding TRACE HTTP method > POST with Content-Type application/json > [http-bio-8080-exec-13] DefaultHttpBinding TRACE HTTP method > POST > [http-bio-8080-exec-13] DefaultHttpBinding TRACE HTTP query > address=3Dlocalhost:58100/api/servers > [http-bio-8080-exec-13] DefaultHttpBinding TRACE HTTP url > http://localhost:8080/camelstubs/camel/tinyproxy2 > [http-bio-8080-exec-13] DefaultHttpBinding TRACE HTTP uri > /camelstubs/camel/tinyproxy2 > [http-bio-8080-exec-13] DefaultHttpBinding TRACE HTTP path > /tinyproxy2 > [http-bio-8080-exec-13] DefaultHttpBinding TRACE HTTP > content-type application/json > [http-bio-8080-exec-13] DefaultUnitOfWork TRACE UnitOfWork > created for ExchangeId: ID-DEVSERVER-56006-1408531950289-0-15 with > Exchange[Message: [Body is instance of org.apache.camel.StreamCache]] > [http-bio-8080-exec-13] EventHelper TRACE Notification > of event is disabled: ID-DEVSERVER-56006-1408531950289-0-15 exchange > created: Exchange[Message: [Body is instance of > org.apache.camel.StreamCache]] > [http-bio-8080-exec-13] DefaultUnitOfWork TRACE Adding > synchronization OnCompletion[CachedOutputStream] > [http-bio-8080-exec-13] CamelHttpTransportServlet TRACE Processing > request for exchangeId: ID-DEVSERVER-56006-1408531950289-0-15 > [http-bio-8080-exec-13] CamelInternalProcessor TRACE Processing > exchange for exchangeId: ID-DEVSERVER-56006-1408531950289-0-15 -> > Exchange[Message: [Body is instance of org.apache.camel.StreamCache]] > [http-bio-8080-exec-13] Pipeline TRACE ExchangeId: > ID-DEVSERVER-56006-1408531950289-0-15 should continue routing: true > [http-bio-8080-exec-13] Pipeline TRACE Processing > exchangeId: ID-DEVSERVER-56006-1408531950289-0-15 >>> Exchange[Message: > [Body is instance of org.apache.camel.StreamCache]] > [http-bio-8080-exec-13] CamelInternalProcessor TRACE Processing > exchange for exchangeId: ID-DEVSERVER-56006-1408531950289-0-15 -> > Exchange[Message: [Body is instance of org.apache.camel.StreamCache]] > [http-bio-8080-exec-13] DefaultErrorHandler TRACE isRunAllowed= () > -> true (Run allowed if we are not stopped/stopping) > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Converting > org.apache.camel.converter.stream.InputStreamCache -> java.lang.String wi= th > value: org.apache.camel.converter.stream.InputStreamCache@4ee3990b > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Using > converter: StaticMethodTypeConverter: public static java.lang.String > > org.apache.camel.converter.IOConverter.toString(java.io.InputStream,org.a= pache.camel.Exchange) > throws java.io.IOException to convert [class > org.apache.camel.converter.stream.InputStreamCache=3D>class java.lang.Str= ing] > [http-bio-8080-exec-13] route4 INFO > > {'HostName':'DEVSERVER','IpAddress':'192.168.1.42','x64':true,'Operating= System':'Windows > Host'} > [http-bio-8080-exec-13] InstrumentationProcessor TRACE log: Recordi= ng > duration: 0 millis for exchange: Exchange[Message: [Body is instance of > org.apache.camel.StreamCache]] > [http-bio-8080-exec-13] DefaultErrorHandler TRACE Is exchangeI= d: > ID-DEVSERVER-56006-1408531950289-0-15 interrupted? false > [http-bio-8080-exec-13] DefaultErrorHandler TRACE Is exchangeI= d: > ID-DEVSERVER-56006-1408531950289-0-15 done? true > [http-bio-8080-exec-13] CamelInternalProcessor TRACE Exchange > processed and is continued routed synchronously for exchangeId: > ID-DEVSERVER-56006-1408531950289-0-15 -> Exchange[Message: [Body is > instance of org.apache.camel.StreamCache]] > [http-bio-8080-exec-13] Pipeline TRACE Processing > exchangeId: ID-DEVSERVER-56006-1408531950289-0-15 is continued being > processed synchronously > [http-bio-8080-exec-13] Pipeline TRACE ExchangeId: > ID-DEVSERVER-56006-1408531950289-0-15 should continue routing: true > [http-bio-8080-exec-13] Pipeline TRACE Processing > exchangeId: ID-DEVSERVER-56006-1408531950289-0-15 >>> Exchange[Message: > [Body is instance of org.apache.camel.StreamCache]] > [http-bio-8080-exec-13] CamelInternalProcessor TRACE Processing > exchange for exchangeId: ID-DEVSERVER-56006-1408531950289-0-15 -> > Exchange[Message: [Body is instance of org.apache.camel.StreamCache]] > [http-bio-8080-exec-13] DefaultErrorHandler TRACE isRunAllowed= () > -> true (Run allowed if we are not stopped/stopping) > [http-bio-8080-exec-13] SendProcessor DEBUG >>>> > Endpoint[ahc:// > > http://localhost:58100/api/servers?bridgeEndpoint=3Dtrue&clientConfig.com= pressionEnabled=3Dtrue&throwExceptionOnFailure=3Dfalse > ] > Exchange[Message: [Body is instance of org.apache.camel.StreamCache]] > [http-bio-8080-exec-13] DefaultAhcBinding TRACE Setting url > http://localhost:58100/api/servers?address=3Dlocalhost:58100/api/servers > [http-bio-8080-exec-13] DefaultAhcBinding TRACE Setting > method > POST > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Converting > org.apache.catalina.connector.ResponseFacade -> java.lang.String with > value: org.apache.catalina.connector.ResponseFacade@6063f5af > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Fallback typ= e > converter org.apache.camel.impl.converter.ToStringTypeConverter@635c80a4 > converted type from: java.lang.String to: > org.apache.catalina.connector.ResponseFacade > [http-bio-8080-exec-13] DefaultAhcBinding TRACE Adding heade= r > breadcrumbId =3D ID-DEVSERVER-56006-1408531950289-0-16 > [http-bio-8080-exec-13] DefaultAhcBinding TRACE Adding heade= r > accept =3D */* > [http-bio-8080-exec-13] DefaultAhcBinding TRACE Adding heade= r > address =3D localhost:58100/api/servers > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Converting > org.apache.catalina.connector.RequestFacade -> java.lang.String with valu= e: > org.apache.catalina.connector.RequestFacade@40bbc1f6 > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Fallback typ= e > converter org.apache.camel.impl.converter.ToStringTypeConverter@635c80a4 > converted type from: java.lang.String to: > org.apache.catalina.connector.RequestFacade > [http-bio-8080-exec-13] DefaultAhcBinding TRACE Adding heade= r > user-agent =3D curl/7.21.7 (amd64-pc-win32) libcurl/7.21.7 OpenSSL/0.9.8r > zlib/1.2.5 > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Converting > org.apache.camel.converter.stream.InputStreamCache -> > com.ning.http.client.BodyGenerator with value: > org.apache.camel.converter.stream.InputStreamCache@4ee3990b > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Converting > org.apache.camel.component.http.HttpMessage -> > com.ning.http.client.BodyGenerator with value: Message: [Body is instance > of org.apache.camel.StreamCache] > [http-bio-8080-exec-13] DefaultAhcBinding TRACE Setting body > com.ning.http.client.generators.InputStreamBodyGenerator@7255cf3f > [http-bio-8080-exec-13] DefaultAhcBinding TRACE Setting > Content-Type application/json > [http-bio-8080-exec-13] AhcProducer DEBUG Executing > request > > http://localhost:58100/api/servers?address=3Dlocalhost%3A58100%2Fapi%2Fse= rvers > POST headers: breadcrumbId:ID-DEVSERVER-56006-1408531950289-0-16 accept:*= /* > address:localhost:58100/api/servers user-agent:curl/7.21.7 (amd64-pc-win3= 2) > libcurl/7.21.7 OpenSSL/0.9.8r zlib/1.2.5 Content-Type:application/json > [http-bio-8080-exec-13] CamelInternalProcessor TRACE Exchange > processed and is continued routed asynchronously for exchangeId: > ID-DEVSERVER-56006-1408531950289-0-15 -> Exchange[Message: [Body is > instance of org.apache.camel.StreamCache]] > [http-bio-8080-exec-13] Pipeline TRACE Processing > exchangeId: ID-DEVSERVER-56006-1408531950289-0-15 is continued being > processed asynchronously > [http-bio-8080-exec-13] CamelInternalProcessor TRACE Exchange > processed and is continued routed asynchronously for exchangeId: > ID-DEVSERVER-56006-1408531950289-0-15 -> Exchange[Message: [Body is > instance of org.apache.camel.StreamCache]] > [http-bio-8080-exec-13] AsyncProcessorHelper TRACE Waiting for > asynchronous callback before continuing for exchangeId: > ID-DEVSERVER-56006-1408531950289-0-15 -> Exchange[Message: [Body is > instance of org.apache.camel.StreamCache]] > [ New I/O worker #2] AhcProducer TRACE > ID-DEVSERVER-56006-1408531950289-0-15 onStatusReceived > com.ning.http.client.providers.netty.ResponseStatus@70d76d51 > [ New I/O worker #2] AhcProducer TRACE > ID-DEVSERVER-56006-1408531950289-0-15 onHeadersReceived > com.ning.http.client.providers.netty.ResponseHeaders@a200d0c > [ New I/O worker #2] AhcProducer TRACE > ID-DEVSERVER-56006-1408531950289-0-15 onBodyPartReceived 2134 bytes > [ New I/O worker #2] AhcProducer TRACE > ID-DEVSERVER-56006-1408531950289-0-15 onCompleted > [ New I/O worker #2] EventHelper TRACE Notification > of event is disabled: ID-DEVSERVER-56006-1408531950289-0-15 exchange > Exchange[Message: [Body is instance of java.io.InputStream]] sent to: > Endpoint[ahc:// > > http://localhost:58100/api/servers?bridgeEndpoint=3Dtrue&clientConfig.com= pressionEnabled=3Dtrue&throwExceptionOnFailure=3Dfalse > ] > took: 5048 ms. > [ New I/O worker #2] InstrumentationProcessor TRACE to: Recordin= g > duration: 5049 millis for exchange: Exchange[Message: [Body is instance o= f > java.io.InputStream]] > [ New I/O worker #2] DefaultErrorHandler TRACE Is exchangeI= d: > ID-DEVSERVER-56006-1408531950289-0-15 interrupted? false > [ New I/O worker #2] DefaultErrorHandler TRACE Is exchangeI= d: > ID-DEVSERVER-56006-1408531950289-0-15 done? true > [ New I/O worker #2] Pipeline TRACE ExchangeId: > ID-DEVSERVER-56006-1408531950289-0-15 should continue routing: false > [ New I/O worker #2] Pipeline TRACE Processing > complete for exchangeId: ID-DEVSERVER-56006-1408531950289-0-15 >>> > Exchange[Message: [Body is instance of java.io.InputStream]] > [ New I/O worker #2] CamelInternalProcessor TRACE route: > Recording duration: 5051 millis for exchange: Exchange[Message: [Body is > instance of java.io.InputStream]] > [ New I/O worker #2] AsyncProcessorHelper TRACE Asynchronous > callback received for exchangeId: ID-DEVSERVER-56006-1408531950289-0-15 > [http-bio-8080-exec-13] AsyncProcessorHelper TRACE Asynchronous > callback received, will continue routing exchangeId: > ID-DEVSERVER-56006-1408531950289-0-15 -> Exchange[Message: [Body is > instance of java.io.InputStream]] > [http-bio-8080-exec-13] CamelHttpTransportServlet TRACE Writing > response for exchangeId: ID-DEVSERVER-56006-1408531950289-0-15 > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Converting > java.lang.String -> java.lang.String with value: > localhost:58100/api/servers > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Converting > java.lang.String -> java.lang.String with value: Wed, 20 Aug 2014 10:58:4= 8 > GMT > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Converting > java.lang.String -> java.lang.String with value: > ID-DEVSERVER-56006-1408531950289-0-16 > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Converting > java.lang.String -> java.lang.String with value: ASP.NET > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Converting > java.lang.String -> java.lang.String with value: 4.0.30319 > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Converting > java.lang.Integer -> java.lang.String with value: 500 > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Using > converter: StaticMethodTypeConverter: public static java.lang.String > org.apache.camel.converter.ObjectConverter.toString(java.lang.Integer) to > convert [class java.lang.Integer=3D>class java.lang.String] > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Converting > java.lang.String -> java.lang.String with value: /tinyproxy2 > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Converting > org.apache.catalina.connector.RequestFacade -> java.lang.String with valu= e: > org.apache.catalina.connector.RequestFacade@40bbc1f6 > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Fallback typ= e > converter org.apache.camel.impl.converter.ToStringTypeConverter@635c80a4 > converted type from: java.lang.String to: > org.apache.catalina.connector.RequestFacade > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Converting > java.lang.String -> java.lang.String with value: curl/7.21.7 > (amd64-pc-win32) libcurl/7.21.7 OpenSSL/0.9.8r zlib/1.2.5 > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Converting > java.lang.String -> java.lang.String with value: application/json; > charset=3Dutf-8 > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Converting > java.lang.String -> java.lang.String with value: chunked > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Converting > java.lang.String -> java.lang.String with value: no-cache > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Converting > java.lang.String -> java.lang.String with value: > http://localhost:8080/camelstubs/camel/tinyproxy2 > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Converting > java.lang.String -> java.lang.String with value: -1 > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Converting > java.lang.String -> java.lang.String with value: POST > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Converting > java.lang.String -> java.lang.String with value: > /camelstubs/camel/tinyproxy2 > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Converting > java.lang.String -> java.lang.String with value: > =3D?UTF-8?B?QzpcUHJvamVjdHNcSHR0cFRlc3RzXEh0dHBUZXN0c1xhcGlcc2VydmVycw=3D= =3D?=3D > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Converting > org.apache.catalina.connector.ResponseFacade -> java.lang.String with > value: org.apache.catalina.connector.ResponseFacade@6063f5af > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Fallback typ= e > converter org.apache.camel.impl.converter.ToStringTypeConverter@635c80a4 > converted type from: java.lang.String to: > org.apache.catalina.connector.ResponseFacade > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Converting > java.lang.Integer -> java.lang.String with value: 2134 > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Using > converter: StaticMethodTypeConverter: public static java.lang.String > org.apache.camel.converter.ObjectConverter.toString(java.lang.Integer) to > convert [class java.lang.Integer=3D>class java.lang.String] > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Converting > java.lang.String -> java.lang.String with value: > address=3Dlocalhost:58100/api/servers > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Converting > java.lang.String -> java.lang.String with value: Microsoft-IIS/8.0 > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Converting > java.lang.String -> java.lang.String with value: no-cache > [http-bio-8080-exec-13] DefaultTypeConverter TRACE Converting > java.lang.String -> java.lang.String with value: */* > [http-bio-8080-exec-13] DefaultHttpBinding DEBUG Streaming > response in chunked mode with buffer size 8192 > [http-bio-8080-exec-13] IOHelper TRACE Copying > InputStream: java.io.ByteArrayInputStream@28ce41cc -> OutputStream: > org.apache.catalina.connector.CoyoteOutputStream@227db754 with buffer: > 2134 > and flush on each write true > [http-bio-8080-exec-13] DefaultUnitOfWork TRACE UnitOfWork > done for ExchangeId: ID-DEVSERVER-56006-1408531950289-0-15 with > Exchange[Message: [Body is instance of java.io.InputStream]] > [http-bio-8080-exec-13] DefaultUnitOfWork TRACE Invoking > synchronization.onComplete: OnCompletion[CachedOutputStream] with > Exchange[Message: [Body is instance of java.io.InputStream]] > [http-bio-8080-exec-13] EventHelper TRACE Notification > of event is disabled: ID-DEVSERVER-56006-1408531950289-0-15 exchange > completed: Exchange[Message: [Body is instance of java.io.InputStream]] > > > > > On 20 August 2014 11:01, Raul Kripalani wrote: > > > You can enable logging in the AHC library by setting the appropriate lo= g > > 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=C3=BAl Kripalani* > > Apache Camel PMC Member & Committer | Enterprise Architect, Open Source > > Integration specialist > > http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalan= i > > http://blog.raulkr.net | twitter: @raulvk > > > > On Wed, Aug 20, 2014 at 9:15 AM, Jaume Sancho 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=3Dtrue&throwExceptionOnFailur= e=3Dfalse > > > "); > > > > > > 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 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 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 ultimatel= y > > > > 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=3Dtrue&throwExceptionOnFailur= e=3Dfalse > > > > > "); > > > > > > > > > > However, when I try to do the same with an AHC component, the bod= y* > > 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=3Dtrue&throwExceptionOnFa= ilure=3Dfalse"); > > > > > > > > > > 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 t= o > be > > > > > passed through when using AHC. > > > > > > > > > > JSON: (using single quotes to avoid parsing issues with Camel) > > > > > {'HostName':'DEVSERVER'} > > > > > > > > > > XML: > > > > > > > > xmlns=3D" > > > > > http://schemas.datacontract.org/2004/07/HttpTests.Models"> > > > > > DEVServer > > > > > > > > > > > > > > > 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/ > > > > > > > > > > --089e0103de5c50f3c505010f7a85--