Hi , Please see my comments in the below mail.
-- Willem Jiang Red Hat, Inc. FuseSource is now part of Red Hat Web: http://www.fusesource.com | http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem Sent with Sparrow (http://www.sparrowmailapp.com/?sig) On Friday, February 1, 2013 at 11:51 PM, Nico Mommaerts wrote: > Hey, > > I'm having a hard time understanding the dataformats in cxf > (http://camel.apache.org/cxf.html#CXF-Thedescriptionsofthedataformats) > and what they are for. > > The use case I'm implementing is like the cxf proxy example > (http://camel.apache.org/cxf-proxy-example.html) except that I want to > add some Soap Headers to the message that is sent to the real > webservice. > I succeeded in doing so by following the example, and getting the > Header element from the Document passed to my enrichBean. However, I > don't understand why this works: > > * How does Camel know to call which method in the enrichBean and why > does it know it has to pass a Document? Couldn't find anything on the > website about this. You can change the parameter of the enrichBean as you want. Camel will try to find a right converter for you. > * It says here > http://camel.apache.org/cxf.html#CXF-SOAPheadersarenotavailableinMESSAGEmode > that SOAP headers are not available in the MESSAGE dataformat, how > come I can access them and change them before sending to the real > webservice? You will not be able to access the SOAP header from the message header of the camel message in MESSAGE data format, as the interceptor of handling the SOAP header will not be called if you use the camel version lower than 2.10.1. In the example you are manipulate the DOM tree which is turned from the input stream, so that is another story. > * If I try any other dataformat then MESSAGE, it doesn't work. I get a > 500, or just an empty SOAP response, or a NullpointerException. What > exactly does the dataformat apply to? The content of the exchange that > is being sent to the next component in my route? It's important for Camel to load right a type converter for you when you using other data formate. Please take some time to go through the converters[1] which is used by the PayLoad data formate . > * Is this the correct (best) way to add a soapheader? It is real depends what's you want to do. If you don't need to change the soap header much, you can even use the xslt component[1], it could be more straight for manipulate the underlay input stream message. > > Thanks, > Nico [1]https://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java