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 D048E200C5C for ; Thu, 6 Apr 2017 07:44:06 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id CEED5160B94; Thu, 6 Apr 2017 05:44:06 +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 C6C72160B86 for ; Thu, 6 Apr 2017 07:44:05 +0200 (CEST) Received: (qmail 20863 invoked by uid 500); 6 Apr 2017 05:44:04 -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 20852 invoked by uid 99); 6 Apr 2017 05:44:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Apr 2017 05:44:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 14AD51A045C for ; Thu, 6 Apr 2017 05:44:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -5.985 X-Spam-Level: X-Spam-Status: No, score=-5.985 tagged_above=-999 required=6.31 tests=[RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H2=-2.796, RCVD_IN_SORBS_SPAM=0.5, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URI_HEX=1.313] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id GoDp88r_JDMp for ; Thu, 6 Apr 2017 05:43:59 +0000 (UTC) Received: from smtpgw.sap-ag.de (smtpgw04.sap-ag.de [155.56.66.99]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 9F8165F1A0 for ; Thu, 6 Apr 2017 05:43:58 +0000 (UTC) From: "Goyal, Arpit" To: "users@camel.apache.org" Subject: RE: Camel Http vs Camel Http4 - Content Type Header Thread-Topic: Camel Http vs Camel Http4 - Content Type Header Thread-Index: AdKDBsjC6BuVmCQTR6SzglZ6oAGKegADdsoAAAJ2wrAKaxsaYAA8VyCAAABL4IAANgxNcA== Date: Thu, 6 Apr 2017 05:43:57 +0000 Message-ID: <9a78b6bb614a446787b2881d913b4447@sap.com> References: <82c767ed74fc4a22bde87ae8b643283c@dewdfe13de47.global.corp.sap> <968c6d4d8cfb4132b37f3c603ffd36e7@dewdfe13de47.global.corp.sap> <63544303-ABF8-4415-86D4-EA0DF4FFEDE5@sap.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.21.23.231] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 archived-at: Thu, 06 Apr 2017 05:44:07 -0000 Hi souciance, Below is the complete test case I have written to debug this problem. You c= an import and fix the 'package' and 'logger' to remove errors. 'createRoute= Builder' method at the end has the two routes using camel-http and camel-ht= tp4. The URLs are constants.=20 I am using the SAP Cloud Identity API [1] which expects Content-Type: appli= cation/scim+json. But if this is not given then it works fine. In case of c= amel-http4 we get 'text/plain' by default.=20 Can't provide credential, you may be able to debug to see the 'Content Type= ' getting set with Camel-Http4 and not getting with Camel-Http Right now my need is to just make it empty like Camel-http. We HAD to move = to camel-http4 because of SSL support. And now this one use-case isn't work= ing :(=20 Regards, Arpit. [1] - https://help.sap.com/viewer/6d6d63354d1242d185ab4830fc04feb1/Cloud/en= -US/2f215687fcf34170b0bbc8b36b60f2e9.html=20 Complete test case import org.apache.camel.CamelContext; import org.apache.camel.EndpointInject; import org.apache.camel.Exchange; import org.apache.camel.Processor; import org.apache.camel.Produce; import org.apache.camel.ProducerTemplate; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.direct.DirectEndpoint; import org.apache.camel.http.common.HttpOperationFailedException; import org.apache.camel.impl.DefaultCamelContext; import org.apache.camel.impl.DefaultExchange; import org.apache.camel.impl.SimpleRegistry; import org.apache.camel.testng.CamelTestSupport; import org.testng.annotations.Test; public class TestSCIMScenario extends CamelTestSupport { static { System.setProperty("javax.net.debug", "all"); System.setProperty("org.apache.commons.logging.Log", "org.apache.common= s.logging.impl.SimpleLog"); System.setProperty("org.apache.commons.logging.simplelog.showdatetime",= "true"); System.setProperty("org.apache.commons.logging.simplelog.log.org.apache= .http", "DEBUG"); } @EndpointInject(uri =3D "direct:startHttp") protected DirectEndpoint startHttp; @EndpointInject(uri =3D "direct:startHttp4") protected DirectEndpoint startHttp4; @Produce(uri =3D "direct:start") protected ProducerTemplate producer; /* Payload based on SAP Cloud Indentity REST API - https://help.sap.com/v= iewer/6d6d63354d1242d185ab4830fc04feb1/Cloud/en-US/2f215687fcf34170b0bbc8b3= 6b60f2e9.html */ private static final String SCIM_PAYLOAD =3D "{\r\n \"userName\": \"alex= Aderson\",\r\n \"name\": {\r\n \"givenName\": \"Alex\",\r\n \"family= Name\": \"Anderson\",\r\n \"honorificPrefix\": \"Mr.\"\r\n },\r\n \"em= ails\": [\r\n {\r\n \"value\": \"alex.anderson@myworld.com\"\r\n = }\r\n ],\r\n \"addresses\": [\r\n {\r\n \"type\": \"home\",\r\n = \"streetAddress\": \"1029 East River Drive\",\r\n \"locality\": \= "Street 301\",\r\n \"region\": \"CA\",\r\n \"postalCode\": \"9440= 1\"\r\n }\r\n ],\r\n \"phoneNumbers\": [],\r\n \"displayName\": \"nos= ample\",\r\n \"company\": \"YYY_USA\",\r\n \"active\": true\r\n}"; /* Camel-Http4 based URL */ private static final String http4Endpoint =3D "https4://.ondem= and.com/service/scim/Users?proxyAuthHost=3Dppppp&proxyAuthPort=3D8888&proxy= AuthScheme=3Dhttp4&authUsername=3Dxxxxxx&authPassword=3Dyyyyy&httpClientCon= figurer=3D#customConfigurer"; /* Camel-Http based URL */ private static final String httpEndpoint =3D "https://.ondeman= d.com/service/scim/Users?proxyHost=3Dppppp&proxyPort=3D8888&authUsername=3D= xxxxxx&authPassword=3Dyyyyy&authMethod=3DBasic"; private static final Logger LOG =3D LogManager.getLogger(); @Test public void testSCIMHttp() throws Exception { DefaultExchange request =3D (DefaultExchange) producer.request(startHtt= p, new Processor() { @Override public void process(Exchange exchange) throws Exception { } }); if (request.getException() !=3D null) { throw request.getException(); } } @Test public void testSCIMHttp4() throws Exception { DefaultExchange request =3D (DefaultExchange) producer.request(startHtt= p4, new Processor() { @Override public void process(Exchange exchange) throws Exception { } }); if (request.getException() !=3D null) { throw request.getException(); } } protected CamelContext createCamelContext() throws Exception { SimpleRegistry registry =3D new SimpleRegistry(); registry.put("customConfigurer", new CustomHttpClientConfigurer()); CamelContext cc =3D new DefaultCamelContext(registry); return cc; } @Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override public void configure() throws Exception { onException(Exception.class).process(new Processor() { @Override public void process(Exchange exchange) throws Exception { Exception exception =3D null; if (exchange !=3D null && exchange.getProperty(CAMEL_PROPERTY_E= XCEPTION_CAUGHT) instanceof Exception) { exception =3D (Exception) exchange.getProperty(CAMEL_PROPERT= Y_EXCEPTION_CAUGHT); } if (exception instanceof HttpOperationFailedException) { HttpOperationFailedException ex =3D (HttpOperationFailedExcep= tion) exception; LOG.info("*********************HTTP FAILED BEGIN*************= ********"); LOG.info("Status Code " + ex.getStatusCode() + " Status Text = " + ex.getStatusText() + " Response Body " + ex.getResponseBody()); LOG.info("*********************HTTP FAILED END***************= ******"); } if(exception !=3D null) { throw exception; =20 } =20 } }); from(startHttp).setBody().constant(SCIM_PAYLOAD).to(httpEndpoint).p= rocess(new Processor() { @Override public void process(Exchange exchange) throws Exception { LOG.info("*********************HTTP SUCCESS BEGIN**************= *******"); LOG.info(exchange.getIn().getBody(String.class)); LOG.info("*********************HTTP SUCCESS END****************= *****"); } }); from(startHttp4).setBody().constant(SCIM_PAYLOAD).setHeader(Exchang= e.CONTENT_TYPE).constant(null).to(http4Endpoint); } }; } } -----Original Message----- From: souciance [mailto:souciance.eqdam.rashti@gmail.com]=20 Sent: Tuesday, April 4, 2017 10:34 PM To: users@camel.apache.org Subject: Re: Camel Http vs Camel Http4 - Content Type Header Can you share your entire route code? Den 5 apr. 2017 5:25 fm skrev "Goyal, Arpit [via Camel]" < ml-node+s465427n5796938h41@n5.nabble.com>: > Anyone else has idea of this camel logic? > > Sent from my iPhone > > > On Apr 3, 2017, at 4:33 PM, Goyal, Arpit <[hidden email] > > wrote: > > > > Hi Claus, > > > > HttpProduce -- from camel-http4 library is setting the content-type > 'text/plain' in method [1] line # 488 (camel version 2.16.3) even though > we have set the Content-Type to be NULL - This is NOT the case with > HttpProducer - from camel-http library. > > > > By enabling the apache commons log, the headers are clearly visible. > > > > The end-system we are invoking throws '415' due to the wrong Content > Type passed and if we DO NOT pass any content type it works. As at > execution time we can't determine the Content-Type, we want to pass it > NULL. > > > > Any possible way to achieve not sending of Content-Type header? > > > > 2017/04/04 00:48:55:618 CEST [DEBUG] headers - http-outgoing-0 >> POST > /service/scim/Users HTTP/1.1 > > 2017/04/04 00:48:55:618 CEST [DEBUG] headers - http-outgoing-0 >> > breadcrumbId: ID-i044312-33503-1491259732621-0-1 > > 2017/04/04 00:48:55:618 CEST [DEBUG] headers - http-outgoing-0 >> > Content-Length: 518 > > 2017/04/04 00:48:55:618 CEST [DEBUG] headers - http-outgoing-0 >> > Content-Type: text/plain ---- in this line. > > 2017/04/04 00:48:55:618 CEST [DEBUG] headers - http-outgoing-0 >> Host: > xxxxxxx > > 2017/04/04 00:48:55:618 CEST [DEBUG] headers - http-outgoing-0 >> > Connection: Keep-Alive > > 2017/04/04 00:48:55:618 CEST [DEBUG] headers - http-outgoing-0 >> > User-Agent: Apache-HttpClient/4.5.2 (Java/1.7.0_101) > > 2017/04/04 00:48:55:618 CEST [DEBUG] headers - http-outgoing-0 >> > Accept-Encoding: gzip,deflate > > 2017/04/04 00:48:55:618 CEST [DEBUG] headers - http-outgoing-0 >> > Authorization: Basic XXXXXXXX > > 2017/04/04 00:48:55:619 CEST [DEBUG] wire - http-outgoing-0 >> "POST > /service/scim/Users HTTP/1.1[\r][\n]" > > 2017/04/04 00:48:55:619 CEST [DEBUG] wire - http-outgoing-0 >> > "breadcrumbId: ID-i044312-33503-1491259732621-0-1[\r][\n]" > > 2017/04/04 00:48:55:619 CEST [DEBUG] wire - http-outgoing-0 >> > "Content-Length: 518[\r][\n]" > > 2017/04/04 00:48:55:619 CEST [DEBUG] wire - http-outgoing-0 >> > "Content-Type: text/plain[\r][\n]" --- in this lin= e > > 2017/04/04 00:48:55:619 CEST [DEBUG] wire - http-outgoing-0 >> "Host: > xxxxxxxxx[\r][\n]" > > 2017/04/04 00:48:55:619 CEST [DEBUG] wire - http-outgoing-0 >> > "Connection: Keep-Alive[\r][\n]" > > 2017/04/04 00:48:55:619 CEST [DEBUG] wire - http-outgoing-0 >> > "User-Agent: Apache-HttpClient/4.5.2 (Java/1.7.0_101)[\r][\n]" > > 2017/04/04 00:48:55:619 CEST [DEBUG] wire - http-outgoing-0 >> > "Accept-Encoding: gzip,deflate[\r][\n]" > > 2017/04/04 00:48:55:619 CEST [DEBUG] wire - http-outgoing-0 >> > "Authorization: Basic XXXXXXXX[\r][\n]" > > 2017/04/04 00:48:55:619 CEST [DEBUG] wire - http-outgoing-0 >> > "[\r][\n]" > > 2017/04/04 00:48:55:619 CEST [DEBUG] wire - http-outgoing-0 >> > "{[\r][\n]" > > 2017/04/04 00:48:55:620 CEST [DEBUG] wire - http-outgoing-0 >> "}" > > > > [1] - org.apache.camel.component.http4.HttpProducer.createRequestEntity= (Exchange) > > > > > Regards, > > Arpit. > > > > > > -----Original Message----- > > From: souciance [mailto:[hidden email] > ] > > Sent: Thursday, February 9, 2017 1:40 PM > > To: [hidden email] > > > Subject: Re: Camel Http vs Camel Http4 - Content Type Header > > > > Well it should be pretty easy to setup a http server and see what > headers > > your route are sending and compare that to what the actual server wants= . > If > > camel-http4 is suppressing some headers then perhaps try another > component. > > > > On Thu, Feb 9, 2017 at 10:32 PM, Goyal, Arpit [via Camel] < > > [hidden email] > > wrote: > > > >> Hi, > >> > >> We were on Camel-Http (2.16) and moving to Camel-Http4 (2.16) and saw > that > >> URL which worked with Camel-http now fails with Camel-Http4 with statu= s > >> code - 415 (Unsupported Media Type). > >> > >> Caused by: org.apache.camel.http.common.HttpOperationFailedException: > >> HTTP operation failed invoking https://:/ > >> myservice/Users?authMethod=3DBasic with statusCode: 415 > >> > >> Saw this discussion on Nabble - http://camel.465427.n5.nabble. > >> com/Http4-Set-Header-Content-Type-not-passing-through-to- > >> the-HTTP-Request-td5746414.html#a5752856 > >> > >> Does this mean we CAN"T USE - Camel-HTTP4 ? > >> > >> Regards, > >> Arpit. > >> > >> > >> ------------------------------ > >> If you reply to this email, your message will be added to the > discussion > >> below: > >> http://camel.465427.n5.nabble.com/Camel-Http-vs-Camel-Http4- > >> Content-Type-Header-tp5793736.html > >> To start a new topic under Camel - Users, email > >> [hidden email] > >> To unsubscribe from Camel - Users, click here > >> < > >> . > >> NAML > >> NamlServlet.jtp?macro=3Dmacro_viewer&id=3Dinstant_html% > 21nabble%3Aemail.naml&base=3Dnabble.naml.namespaces. > BasicNamespace-nabble.view.web.template.NabbleNamespace- > nabble.view.web.template.NodeNamespace&breadcrumbs=3D > notify_subscribers%21nabble%3Aemail.naml-instant_emails% > 21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > >> > > > > > > > > > > -- > > View this message in context: http://camel.465427.n5.nabble. > com/Camel-Http-vs-Camel-Http4-Content-Type-Header-tp5793736p5793737.html > > Sent from the Camel - Users mailing list archive at Nabble.com. > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > http://camel.465427.n5.nabble.com/Camel-Http-vs-Camel-Http4- > Content-Type-Header-tp5793736p5796938.html > To start a new topic under Camel - Users, email > ml-node+s465427n465428h31@n5.nabble.com > To unsubscribe from Camel - Users, click here > > . > NAML > > -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Http-= vs-Camel-Http4-Content-Type-Header-tp5793736p5796944.html Sent from the Camel - Users mailing list archive at Nabble.com.