In my application I have to consume a service provided by a third party application. The response they provide is always 200 and they change the body based on whether data is available or not or error occurred, as given below
If data is there then
<products>
<product></product>
<product></product>
</products>
If data is empty then
<message> No record found </message>
If some validation failed then
<error>Invalid Id</error>
I am using RestTemplate.exchange
to consume the service, my question is if there only single type of root element then we pass the respective class as ParameterizedTypeReference
but here how to map the response and unmarshall it.
Use jaxb or jackson to unmarshall the xml.