XPath with CXF Pojo Endpoint

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

XPath with CXF Pojo Endpoint

jjathman
I have a CXF endpoint that is deserializing the XML received in to a POJO (JAXB objects). This is all working just fine for us. Now we had a new requirement come up to take a fragment of the received XML and audit it in a particular way. What seems like the most ideal solution would be to use the setHeader functionality and xpath to grab the particular fragment, however this doesn't seem to work. It looks like because I'm using a POJO endpoing that I can't do this? Is this true or do I have something configured incorrectly? Here's the applicable code fragment and exception I'm getting. Any help would be appreciated. Thanks.


Code:
from("cxf:bean:XCPDMessageEndpoint").setHeader("queryByParameter", xpath("/s:Envelope/s:Body/PRPA_IN201305UV02/controlActProcess/queryByParameter").resultType(String.class).namespaces(namespace))


Exception:
Caused by: org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type: org.apache.cxf.message.MessageContentsList to the required type: org.w3c.dom.Document with value [org.hl7.v3.PRPAIN201305UV02@4c79ee9e]
        at org.apache.camel.builder.xml.XPathBuilder.doGetDocument(XPathBuilder.java:1147)
        at org.apache.camel.builder.xml.XPathBuilder.getDocument(XPathBuilder.java:1092)
Reply | Threaded
Open this post in threaded view
|

Re: XPath with CXF Pojo Endpoint

RAvontuur
I would suggest adding a
.unmarshal(jaxb)  before the xpath

where
        jaxb = new JaxbDataFormat();
        jaxb.setContextPath("..your context path..");

or using the PAYLOAD-mode in your cxf-endpoint.
Reply | Threaded
Open this post in threaded view
|

Re: XPath with CXF Pojo Endpoint

RAvontuur
it shoud be a .marshal(jaxb)  in stead of an .unmarshal(jaxb), of course, as the direction is serializing.