I send XML through an HTTP request through Spring RestTemplate to an external gateway and I get an XML response.
The XSD that was given the answer confirmation has a target namespace, but the actual response does not contain a namespace prefix. I created Java resources using XSD, and because of this, I get below errors when receiving a response (during the unmarshalling process),
ResponseEntity<Response> responseEntity = restTemplate.exchange(endpointURL, HttpMethod.POST, requestEntity, Response.class);
The exception is: -
Exception in thread "main" javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"Response"). Expected elements are <{http://securetransport.dw/rcservice/xml}Response>
Is there a way to skip namespace validation from Spring ResponseEntity?
source share