Unmarshalling an xml element that is not part of the namespace

I have an xml response coming from a web service:

<ns2:response xmlns:ns2="http://abc.com">
  <ns2:msgHeader>
    <ns2:empid>1234</ns2:empid>
    <ns2:empname>John</ns2:empid>
  </ns2:msgHeader>
  <error>
    <httpstatus>500</httpstatus>
    <description>Error while processing the request.Please contact customercare</description>
  </error>
</ns2:response>

How can I cancel the marker when the xml-scheme is in this format. <error>is part of the root element <response>.

I am using Restful client and using resttemplate to query the server. My applicationcontext.xmluses org.springframework.http.converter.xml.MarshallingHttpMessageConverterto sort and unmap XML requests and responses.

+3
source share
2 answers

Do you have xsd? I assume the element should be defined in xsd

0
source

, response, error, ( , ). error targetNamespace.

0

All Articles