So, adding a soapheader is not a problem anymore, I configured the dataformat to CXF_MESSAGE, and added a processor in which I can simply add header elements.
But my original problem remains, as soon as I change the dataformat to something different from MESSAGE, the request-reply doesn't work correctly anymore, even without the processor. I send a SOAP message using SoapUI to my camel application, which routes it to a real webservice (SoapUI MockServer in this case), which sends back the response. This works fine with MESSAGE dataformat, but with the CXF_MESSAGE dataformat I always get an empty Soap envelope back as response. What am I missing here? My config is below: <cxf:cxfEndpoint id="broker"> ... </cxf:cxfEndpoint> <camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring "> <endpoint id="realWS" uri=" http://localhost:8080/service?throwExceptionOnFailure=true" /> <route> <from uri="cxf:bean:broker?dataFormat=CXF_MESSAGE" /> <to ref="realWS" /> </route> </camelContext> On Mon, Feb 4, 2013 at 11:31 AM, Nico Mommaerts <nico.mommae...@gmail.com>wrote: > Thanks Willem for the answer, I'll see if that gets me any further. > I am using Camel 2.10.3 for the record. All I want to do is add some > elements to an empty SOAP header. > > On Mon, Feb 4, 2013 at 4:02 AM, Willem jiang <willem.ji...@gmail.com> > wrote: > > 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 > > > > >