Marshal POJO back to XML

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Marshal POJO back to XML

Paul Broughton
Hi, I am reasonably certain I am missing something obvious here so hopefully somebody will be able to spot  that straight away.​

I have a JSON packet coming into a route which is being unmarshaled and pushed into a dozer mapping which produces me a POJO (test.MYPOJO) of a type that was originally generated using JAXB
When I try to marshal that object I get an error "no body available of type: javax.xml.bind.JAXBElement". This is of course true, the $body is of the type  test.MYPOJO. I know that test.MYPOJO has the necessary anotations so I am assume I need to get to the JAXBElement within the class but for the life of me I cant work out how.

I am using camel 2.23.0
I have a JAXBDataFormat defined that has setIgnoreJAXBElement set to false as per the guide. I can prove that I am able to unmarshal an xml example as well using the dataformat.

any advice would me much appreciated