Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 7E2A6200BAD for ; Tue, 25 Oct 2016 19:44:31 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 7C9BC160AF3; Tue, 25 Oct 2016 17:44:31 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C2B37160AD8 for ; Tue, 25 Oct 2016 19:44:30 +0200 (CEST) Received: (qmail 6072 invoked by uid 500); 25 Oct 2016 17:44:29 -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 6054 invoked by uid 99); 25 Oct 2016 17:44:29 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Oct 2016 17:44:29 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 18667C6C7D for ; Tue, 25 Oct 2016 17:44:29 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.679 X-Spam-Level: * X-Spam-Status: No, score=1.679 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id I1WH9PX93awP for ; Tue, 25 Oct 2016 17:44:27 +0000 (UTC) Received: from mail-yb0-f177.google.com (mail-yb0-f177.google.com [209.85.213.177]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 14AFA5FB57 for ; Tue, 25 Oct 2016 17:44:27 +0000 (UTC) Received: by mail-yb0-f177.google.com with SMTP id 205so2703067ybg.4 for ; Tue, 25 Oct 2016 10:44:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=jMBBhNMmtbO2IVFAE5sbol37yQJpLaH9jMXBa2bf1Wo=; b=zq/TLuAUSP61SnsDyraIw+rIWwaKAknY7zOap0729eu8148PtFhFniga69VHqXu0d+ u37BN/QAAROa2++n1L6ZSpyuH2bgC9S0i5Vh/3LTYdQ1+Bo80pXXXBOFP8gP4lfm1t66 g2u+t+pUNF6caOMAvwqOWYI5wKkZnqR4RMhrUzT+3IV6P+fyQOTCceym+PEDewl+/Q1N QSeEPjCZd/ua9u014v4Vb6rBLW1mBPala5tdy76g94TWVuHI7iRpxTC04m9pfDFrPMl/ jIDbkb5xJc9+yJji6gyvA//gYes/1DY+BiGnZIr3ajdxBpD/99vGmOT6yWyNG1WmH75n QNCw== 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; bh=jMBBhNMmtbO2IVFAE5sbol37yQJpLaH9jMXBa2bf1Wo=; b=IjA4DshXRIThEdxAbtNec9bGwWQQeZpbm3Xpd/ARJVCRwPSgA86kuFWwcHpe1LpI5a /jzbnVRH4eB0/jvirrbqDQ9qXulISJma9vtRw3kBPtxOBN5MH4pTcobXDGpVhhQKlFps d6kaCqhSaXjUq3IFkSbC83ImOAaqJYAkhTeTxdfxVkdTwZ8yYh0urXkyll2p2RVmETVs w4o5UgkoGsjYihp/juoCMP0v3Ui37+cdXTCkTQS2Ba/kOVfVPgbqT0z48i3LwvuxNNtk BqvlEk1S6hb8whTHWMF+vor53+O0Ss/zx/YdOQJtmv1ssB/NCeFE4C8Lp+ceQzxEPPUw RlWg== X-Gm-Message-State: ABUngvdsOVPuQJ5wBIJVYFoh79F84x11L/uoJ9GUx/7AG40fgqOfklxsaCKaGmSpwomOyIbzY67NnIuFSXm4fw== X-Received: by 10.37.171.39 with SMTP id u36mr24064739ybi.128.1477417164139; Tue, 25 Oct 2016 10:39:24 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.196.197 with HTTP; Tue, 25 Oct 2016 10:39:23 -0700 (PDT) In-Reply-To: References: <00BCD2BEF4977149A7C7303B4BAEBBE622CFA07F@ORD2MBX01D.mex05.mlsrvr.com> From: aravind r Date: Tue, 25 Oct 2016 13:39:23 -0400 Message-ID: Subject: Re: Trouble accessing Response body content from RESTful call To: users@camel.apache.org Content-Type: multipart/alternative; boundary=94eb2c184f5840f318053fb3fdf4 archived-at: Tue, 25 Oct 2016 17:44:31 -0000 --94eb2c184f5840f318053fb3fdf4 Content-Type: text/plain; charset=UTF-8 Hi Steve, Are u logging the Message body somewhere before consuming (say Camel logger in between),that could also lead to input stream consumption. Regards, Aravind On Tue, Oct 25, 2016 at 1:15 PM, Doug Douglass wrote: > I can't say where the response body is being consumed, but try enabling > stream caching[1] and see what you get. > > Doug > > [1] http://camel.apache.org/stream-caching.html > > On Tue, Oct 25, 2016 at 9:31 AM, Steve Huston > wrote: > > > I am developing a route that calls a web service; said web service > returns > > a JSON string (Not always the same type represented). I have this in a > > route as: > > > > from(myqueue) > > .bean(SetupCxfRequest.class) // This sets up parameters for > > REST API call > > .convertBodyTo(org.apache.cxf.message.MessageContentsList.class) > > .to("cxfrs:bean:ws?throwExceptionOnFailure=false") > > .bean(WebServiceResponse.class) > > > > SetupCxfRequest will: > > exchange.setPattern(ExchangePattern.InOut); > > // Indicate using Proxy API. > > in.setHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API, > > Boolean.FALSE); > > in.setHeader(CxfConstants.OPERATION_NAME, VerifyEmployeeRequest); > > > > The web service interface method for the call in question is: > > @GET > > @Path(value="/authentication/{company}/employees/{id}") > > @Produces({ MediaType.APPLICATION_JSON }) > > public Response VerifyEmployeeRequest(@PathParam("company") String > > scac, > > @PathParam("id") String id, > > @QueryParam("pin") String pin, > > @QueryParam("reason") String > > reason); > > > > The case I'm working now is that the web service is called and it returns > > a 404 status with a body of JSON-marshaled stuff I need to get at. > > From my route above, WebServiceResponse is then called as: > > > > public class WebServiceResponse { > > > > @Handler > > public Object convertWebServiceResponse(Response wsResponse, > > Exchange exchange) throws IOException { > > ObjectMapper unmarshaller = new ObjectMapper(); > > Class target = null; > > Message in = exchange.getIn(); > > int opStatus = wsResponse.getStatus(); > > if (opStatus == 200) > > target = EmployeeVerificationResponseAc > cept.class; > > else > > target = EmployeeVerificationResponseDeny.class; > > > > So far, so good - opStatus is 404. I need to get the string which is the > > response body and then unmarshall it. > > wsResponse.entity is a SequenceInputStream and one of the input streams > > appears to be the string I'm expecting from the web service; however, it > > has been completely consumed (length and position are the same). Where > did > > it go, and how can I get it? > > > > Thanks, > > -Steve > > > > > --94eb2c184f5840f318053fb3fdf4--