camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Karlsen <davidkarl...@gmail.com>
Subject Re: HTTP Post component - parameters
Date Tue, 25 Oct 2011 19:17:40 GMT
I have it working with http (but could not get it working with ahc):

			<camel:setHeader headerName="CamelHttpMethod">
				<camel:constant>POST</camel:constant>
			</camel:setHeader>
			<camel:setHeader headerName="Content-Type">
				<camel:constant>application/x-www-form-urlencoded</camel:constant>
			</camel:setHeader>
				<camel:setBody>
					<camel:simple>param1=${in.body}&amp;param2=${in.headers.someParam}</camel:simple>
				</camel:setBody>
<camel:to uri="http://......" />

2011/10/25 esprit <tomas.adamek@espr.it>:
> Hi,
>
> I am really struggling to get camel send HTTP request with post data in my
> Bean.
>
> I have simple route jetty listener -> bean -> http call to url.
>
> At first I implemented the http as a GET (so I basically create the HTTP
> query by myself and then set it to exchange header - but now I would like to
> change the type of this request to post and I can't make it working.
>
> I've added the post header to my spring route definition and I can see that
> camel now sends to POST request (which is fine). But I don't know how can I
> set my parameters into message body.
>
> My problems are:
>
> 1) I assume I should use the getOut() message body for setting parameter ?
> 2) should I create a map of parameters and then somehow convert it to body
> message? Or can I keep it as a query string and camel magically coverts this
> string to parameter map?
>
> Thanks you very much!
>
> BTW I'm sorry for asking maybe stupid question but I wasn't able to find
> anything related to actual form of body message on the site pages (and
> honestly I find it very difficult to use as anytime I am trying to do some
> thing with camel I actually need to try and test as I miss some really
> simple examples how to do some basic stuff. Maybe its just my fault and I'm
> not looking on right places?)
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/HTTP-Post-component-parameters-tp4937377p4937377.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
--
David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen

Mime
View raw message