On Mar 26, 2014, at 8:00 AM, chaij <[email protected]> wrote:
> I use CXF endpoint in CXF_MESSAGE format. The incoming message body is type
> of SOAPMessage.
>
> This request is wsdl first approach and I have access to all the wsdl2java
> generated classes. I wonder if there is an easy way to convert this message
> to POJO?
> Camel must be doing it since that is behavior when CXF endpoint data format
> is POJO.
If you need the POJO’s, just use the CXF POJO mode. CXF will then unmarshall
the incoming data directly into the JAXB objects and avoid all the intermediary
types which can consume extra memory and processing time and such.
If you NEED to use CXF_MESSAGE (and there shouldn’t be any reason to use
CXF_MESSAGE), then you would need to do something like an XPath to select the
first element in the soap:Body element and then a convert using the JAXB data
binding thing. Something like:
DataFormat jaxb = new JaxbDataFormat("com.acme.model");
from (“cxf:….”)
.filter().xpath(“//soap:Body/*”, new Namespaces(“soap”,
“http://schemas.xmlsoap.org/wsdl/soap/”))
.unmarshall(jaxb)
.to(…….)
Like I said though, don’t do that unless there really is a big reason for it,
which usually there is not. Just let CXF do it’s job.
--
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com