Hi Michael, You can get the dataFromat info by checking the exchange's property. Camel 2.0 exchange.getProperty(org.apache.camel.component.cxf.DataFormat.class.getName());
For Camel 1.x, you may try to use this exchange.getProperty(org.apache.camel.component.cxf.CxfExchange.DATA_FORMAT); Willem Michael Ramnarine wrote: > Thanks Willem, > > We were looking to write a custom processor that doesn't know ahead of > time which dataFormat the client will be using to access the endpoint. > > Is there anything on the camel exchange or camel message or cxf message > that we can check to at least tell which dataFormat is coming into the > custom processor? I suppose we could check the class type of the > exchange.getIn().getBody(), but can you think of a better way? > > -Mike > > -----Original Message----- > From: Willem Jiang [mailto:[email protected]] > Sent: Friday, March 20, 2009 3:21 AM > To: [email protected] > Subject: Re: Questions about camel Exchange that contains a CxfMessage > with POJO dataFormat > > Hi Michael, > > Since CXF using Stax to handle the XML message , it does not cache the > whole xml message when it do the marshaling work. > > For the POJO Dataformate, you can't get the xml message from the > CXFMessage instace, since the inputstream is consumed by the > XMLStreamReader. > > Can I know the reason why are you want to get the xml message even you > have the list of the request parameters ? > > Willem > > Michael Ramnarine wrote: >> One thing I just noticed... >> Using getContentFormats() on a POJO CxfMessage for a soap over http > endpoint via: >> CxfMessage message = (CxfMessage) exchange.getIn() >> message.getMessage().getContentFormats() >> >> Returns: >> [interface java.util.List, class java.io.InputStream, interface > javax.xml.stream.XMLStreamReader, interface org.w3c.dom.Node] >> Will one of these have the original xml message? >> How do I use these content formats to get that message in w3c format? > >> -Mike >> >> ________________________________________ >> From: Michael Ramnarine >> Sent: Thursday, March 19, 2009 10:46 PM >> To: '[email protected]' >> Subject: Questions about camel Exchange that contains a CxfMessage > with POJO dataFormat >> Is the original xml message available given a camel Exchange for a > soap message that contains a CxfMessage with POJO dataFormat? >> Specifically, working in a custom processor, if the inbound message is > a CxfMessage with MESSAGE dataFormat, the body is a copy of the original > raw message (accessible via exchange.getIn().getBody()). However, if > the inbound message is POJO dataFormat, then getBody() only returns a > list containing the Java parameters for the operation being invoked. Is > there anyway to get at the raw xml message when the inbound message is > in POJO dataFormat? >> Also, is there a way to determine the dataFormat (MESSAGE, PAYLOAD, or > POJO) from the camel Exchange or CxfMessage? >> -Mike >> >> > >
