Hi

Sorry, missed your original query.

Yes, returning DOMSource should do the trick.
I'm wondering, may be we can start supporting users returning XMLStreamWriters/Readers ? CXF ships with quite a few DOM-based stream writers/readers. I need to look more into it....

cheers, Sergey

----- Original Message ----- From: "Eugeny N Dzhurinsky" <[email protected]>
To: <[email protected]>
Sent: Thursday, June 25, 2009 10:06 AM
Subject: Re: Create XML response from REST service

On Thu, Jun 25, 2009 at 10:47:02AM +0300, Eugeny N Dzhurinsky wrote:
Hello, everybody!

I need to return the complex XML as a result of the REST call to the service.
I've looked at the documentation and realized that it is possible to

- use JAXB and serialize the complex object
- use custom message body handlers
- simply return String with the XML content

However because of the fact the underlying service returns org.w3c.dom.Document,
looks like I have to use either custom message body handler for Document
object, or serialize XML to a String and return the String object.

So could somebody please explain, what is the best way to return the custom
XML having a DOM model available? May be there is some standard way of doing
such kind of things in CXF I am not aware of?

Thank you in advance!

Looks like I've found the solution with using javax.xml.transform.Source as a
return type, and javax.xml.transform.dom.DOMSource as the actual result of the
method.

--
Eugene N Dzhurinsky

Reply via email to