Announcement Announcement Module
Collapse
No announcement yet.
RESTTemplate / Message Converter: text/plain to Source Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • RESTTemplate / Message Converter: text/plain to Source

    I have a web service that returns an XML document and I'd like the RESTTemplate to convert the content of the document to javax.xml.transform.Source. Unfortunately, the web service encodes the document as text/plain. This causes the SourceHTTPMessageConverter to reject the message.

    My initial solution is to use StringHTTPMessageConverter and then parse the document using a DOMBuilder. Another solution seems to be to override the readInternal() method in StringHTTPMessageConverter, performing the conversion there.

    Is there a more elegant way to do this?
    Last edited by sffil; Oct 5th, 2010, 07:17 PM. Reason: Spelling error
Working...
X