I am integrating third party API using Rest Template, which will send the response in the format of XML. But for some of the request, getting the below error.
Could not unmarshal to [class com.xxx.SearchResponse]: null; nested exception is javax.xml.bind.UnmarshalException\n - with linked exception:\n[com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence.
I tried with contentType as "application/xml", "text/plain", "text/xml" , "text/xml,charset=UTF-8"
Only for some of the response, getting this error and also xml response has too many lines. Hard to detect the characters facing this problem. I guess some content type i am missing it.
XML Element:
<search-response xmlns="" xmlns:info="" xmlns:common="">
<search-response>
When i hit the third party API in the postman, getting the content type as "text/xml;charset=ISO-8859-1"