On 1/24/11 5:49 PM, unmarshall wrote:
Hi,
I am trying to set custom headers on a camel message. Now when this message
gets converted to Cxf message and becomes a part of the CxfExchange then the
custom headers are put into the Cxf message depending on the DataFormat
(Payload/Message/Pojo).
For Payload the headers are placed under PROTOCOL_HEADERS
For POJO i guess it is placed under SOAP headers
For Message headers i guess the message is a SOAP message so it should go as
part of the SOAP header (not sure).
What kind of Custom headers do you want to put?
The PROTOCOL_HEADERS is used for the CXF transport such as Http headers,
JMS headers. It's unified for different DataFormat, as the message will
finally send or receive from the transport layer no matter what kind of
Data Format you are choicing.
For the MESSAGE DataFormat, I don't think you can change the SOAP
message header by setting the message header, as the SOAP message is not
create by camel-cxf component when it is working in this Data Format.
The point is that the extraction of headers during the invocation of the CXF
interceptor chain becomes then coupled with the DataFormat and makes it
unnecessarily complex.
This is not the case when custom properties are added to the Camel exchange.
All custom properties then available under INVOCATION_CONTEXT /
REQUEST_CONTEXT and that behavior is common and not dependent on the
DataFormat of the messages contained inside the exchange.
The REQUEST_CONTEXT is kind of CXF API which is used to set the customer
header, and camel-cxf component just pass this context into CXF message.
If you don't want other Camel components to access the this kind of
customer header, you can do it in that way.
Is there a cleaner way to place the custom message headers in only one
place?
Yeah, we need to think about it :)
But for now, there are different level of message header that can be set
into the Camel message or Camel exchange. We need to go through them and
put them into different catalogs .
Best Regards,
Madhav
--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang