Hi Mario, I just fixed the SOAP header bug CAMEL-1088[1] last week. You should get the SOAP header by using Camel 1.5.1-snapshot. Here is an example of it in the CXF wiki page[2].
For the SOAP message, you could use the Provider[3] API to get the SOAPMessage in your processor, by checking the SOAPMessage object's type class , I think it is easy to determine the SOAP protocol version. [1] https://issues.apache.org/activemq/browse/CAMEL-1088 [2] http://activemq.apache.org/camel/cxf.html#CXF-HowtodealwiththemessageforthecamelcxfendpointinPAYLOADdataformat [3] http://activemq.apache.org/camel/cxf-example.html#CXFExample-CXFexampleforusingtheWebServiceProviderAPI Willem mario_horny wrote: > Hi again, > > the snipped given by Willem works fine! > > But this brings me to another question. How can I determine, which > dataFormat is used to send the data ? My first thought was to check out the > message header attribute "QUERY_STRING". But since this is empty, I've got > no idea. Anyone out there with a hint ? > > Another question I'm currently facing in this conjunction is, how to > determine the SOAP protocol version (1.1 or 1.2) in the process() method. > Again, any help is welcome. > > Greets, > Mario > > > mario_horny wrote: >> Hi all, >> >> I have a custom processor that needs to transform a cxf message before it >> is routed to the destination endpoint. The code of the process() method >> looks like that: >> >> public void process( Exchange e ) { >> >> Message iMsg = e.getIn(); >> >> msgStr = iMsg.getBody(String.class).toString(); >> >> System.out.println("Received msg=" + msgStr ); >> >> // do the transformation .... >> String transStr = doTransform( msgStr ); >> >> Message oMsg = e.getOut(); >> >> oMsg.setBody( transStr); >> >> } >> >> This works pretty fine, if the dataFormat is POJO or MESSAGE (defined in >> the RouteBuilder). In these cases, the Java parameter (POJO) or the whole >> xml message (MESSAGE) are printed out by the println(...) . If the >> dataFormat is PAYLOAD, only the class reference [EMAIL PROTECTED] >> is printed out. >> >> I could find no way to get the payload data as a string. I read that I >> need to write an own converter to get the data, but at the end of the day >> my problem is that I could find no way to get the data in any format (I'm >> not fixed to use a string object). >> I tried to get the body as a Map, InputStream, Collection, >> MessageContentsList... but non of these classes worked. I found out that >> some the classes work for some dataFormats (InputStream works fine for >> MESSAGE, MessageContentsList works fine for POJO), but nothing worked out >> for PAYLOAD. >> >> Does anybody have an example how to access the message body for >> dataFormat=PAYLOAD ? Is there a common way to access the body for all >> dataFormats ? >> >> Many thanks in advance, >> Mario >> >
