You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by bocamel <jo...@gmail.com> on 2013/10/30 02:27:44 UTC

Message headers and HTTP

In my routes, I use custom message headers to keep track some data.  But when
one of the steps in the route is a HTTP call (for example calling a web
services), all my headers are sent as HTTP headers to the remote HTTP
server.  This causes the remote HTTP server (which is not under my control)
to return a HTTP 404.  (One thing I noticed is that the remote HTTP server
is perfectly OK with JMS headers, e.g. JMSXGroupID.  It just does not like
any custom message header that I define.)

I know Camel lets me remove all the headers before going to the http
endpoint.  But I still need these header data once the http request
completes.  Any suggestion on how I can use http headers effectively in such
situation?  Is there an easy way I can stash away these headers and restore
them after the http call?  I tried to use Exchange properties to keep track
of the data.  But the data do not survive across routes.

Thank you for your help!



--
View this message in context: http://camel.465427.n5.nabble.com/Message-headers-and-HTTP-tp5742364.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Message headers and HTTP

Posted by bocamel <jo...@gmail.com>.
bibryam,

HeaderFilterStrategy worked out beautifully. I simply extended the
CxfHeaderFilterStrategy.

Thank you!



--
View this message in context: http://camel.465427.n5.nabble.com/Message-headers-and-HTTP-tp5742364p5742374.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Message headers and HTTP

Posted by Christian Posta <ch...@gmail.com>.
You may wish to also check out the Enrich EIP.
You can call into a route or external system, then aggregate the
response however you'd like (keeping or discarding headers as you
wish)

http://camel.apache.org/content-enricher.html

On Tue, Oct 29, 2013 at 7:17 PM, Bilgin Ibryam <bi...@gmail.com> wrote:
> Use HeaderFilterStrategy to specify which headers should be sent with the
> http request.
> It will preserve the headers in the exchange
>
> Cheers,
>
>
>
> On 30 October 2013 01:27, bocamel <jo...@gmail.com> wrote:
>
>> In my routes, I use custom message headers to keep track some data.  But
>> when
>> one of the steps in the route is a HTTP call (for example calling a web
>> services), all my headers are sent as HTTP headers to the remote HTTP
>> server.  This causes the remote HTTP server (which is not under my control)
>> to return a HTTP 404.  (One thing I noticed is that the remote HTTP server
>> is perfectly OK with JMS headers, e.g. JMSXGroupID.  It just does not like
>> any custom message header that I define.)
>>
>> I know Camel lets me remove all the headers before going to the http
>> endpoint.  But I still need these header data once the http request
>> completes.  Any suggestion on how I can use http headers effectively in
>> such
>> situation?  Is there an easy way I can stash away these headers and restore
>> them after the http call?  I tried to use Exchange properties to keep track
>> of the data.  But the data do not survive across routes.
>>
>> Thank you for your help!
>>
>>
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/Message-headers-and-HTTP-tp5742364.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>
>
> --
> Bilgin Ibryam
>
> Apache Camel & Apache OFBiz committer
> Blog: ofbizian.com
> Twitter: @bibryam <https://twitter.com/bibryam>
>
> Author of Instant Apache Camel Message Routing
> http://www.amazon.com/dp/1783283475



-- 
Christian Posta
http://www.christianposta.com/blog
twitter: @christianposta

Re: Message headers and HTTP

Posted by Bilgin Ibryam <bi...@gmail.com>.
Use HeaderFilterStrategy to specify which headers should be sent with the
http request.
It will preserve the headers in the exchange

Cheers,



On 30 October 2013 01:27, bocamel <jo...@gmail.com> wrote:

> In my routes, I use custom message headers to keep track some data.  But
> when
> one of the steps in the route is a HTTP call (for example calling a web
> services), all my headers are sent as HTTP headers to the remote HTTP
> server.  This causes the remote HTTP server (which is not under my control)
> to return a HTTP 404.  (One thing I noticed is that the remote HTTP server
> is perfectly OK with JMS headers, e.g. JMSXGroupID.  It just does not like
> any custom message header that I define.)
>
> I know Camel lets me remove all the headers before going to the http
> endpoint.  But I still need these header data once the http request
> completes.  Any suggestion on how I can use http headers effectively in
> such
> situation?  Is there an easy way I can stash away these headers and restore
> them after the http call?  I tried to use Exchange properties to keep track
> of the data.  But the data do not survive across routes.
>
> Thank you for your help!
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Message-headers-and-HTTP-tp5742364.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Bilgin Ibryam

Apache Camel & Apache OFBiz committer
Blog: ofbizian.com
Twitter: @bibryam <https://twitter.com/bibryam>

Author of Instant Apache Camel Message Routing
http://www.amazon.com/dp/1783283475