Can JAX-B include an XML value attribute verbatim?

I have an object that is the return value for a web service method. One of its properties contains an XML document. Ideally, I would like JAX-B to include this XML document in response to the web service, and not to avoid everything, or should cancel it in order to allow the webservice mapping to immediately marshal it.

Can this be done using annotations or defining a custom binding?

EDIT: The reason I want to do this is because the XML document is retrieved from the Oracle database (XmlType column type) and I generally want to avoid unnecessary parsing / formatting steps to get it for the web service client .

+3
source share
1 answer

I think you need to first convert the XML string to an object org.w3c.dom.Element, add it to your model and annotate it with @XmlAnyElement. JAXB then serializes this as verbatim XML (schema validation fails).

+2
source

Source: https://habr.com/ru/post/1795973/


All Articles