You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Aki Yoshida <sa...@googlemail.com> on 2010/12/23 15:54:56 UTC

Passing some properties from Camel to CXF

Hi,
I am trying to pass the Camel headers to the CXF component, but
somehow I am having trouble. For example, when I use the following
configuration:

      <camel:from uri="file:..."/>
      <camel:setHeader headerName="myheader">
          <camel:constant>myvalue</camel:constant>
      </camel:setHeader>	
      <camel:to uri="cxf:bean:..." />

I thought this header would be placed somewhere in the CXF message so
that I could access it from CXF.
But somehow I couldn't find it in the CXF message.

To find out where it is placed, I went through CxfProducer. The header
value is visible in the Camel's inbound message's header. But somehow
I found only the code that reads the operation name form the camel
message's header but didn't find the part that copies the rest of the
camel message's headers into somewhere in the CXF message or exchange.

Could someone tell me where I can find the headers?

Thanks.
Regards, Aki

Re: Passing some properties from Camel to CXF

Posted by William Tam <em...@gmail.com>.
On CXF side, you can access headers like this:

import org.apache.cxf.message.Message;

Message cxfMessage;

Map<String, List<String>> cxfHeaders = 
(Map)cxfMessage.get(Message.PROTOCOL_HEADERS);
List<String> values = cxfHeaders.get("myheader");


On 12/23/2010 09:54 AM, Aki Yoshida wrote:
> Hi,
> I am trying to pass the Camel headers to the CXF component, but
> somehow I am having trouble. For example, when I use the following
> configuration:
>
>        <camel:from uri="file:..."/>
>        <camel:setHeader headerName="myheader">
>            <camel:constant>myvalue</camel:constant>
>        </camel:setHeader>	
>        <camel:to uri="cxf:bean:..." />
>
> I thought this header would be placed somewhere in the CXF message so
> that I could access it from CXF.
> But somehow I couldn't find it in the CXF message.
>
> To find out where it is placed, I went through CxfProducer. The header
> value is visible in the Camel's inbound message's header. But somehow
> I found only the code that reads the operation name form the camel
> message's header but didn't find the part that copies the rest of the
> camel message's headers into somewhere in the CXF message or exchange.
>
> Could someone tell me where I can find the headers?
>
> Thanks.
> Regards, Aki
>