【发布时间】:2016-06-24 20:18:07
【问题描述】:
我通过 Spring RestTemplate 通过 HTTP 请求将 XML 发送到外部网关,并且收到了返回的 XML 响应。
用于验证响应的 XSD 具有目标命名空间,但实际响应不包含命名空间前缀。我已经使用 XSD 生成了 Java 资源,因此在(在解组过程中)获得响应时出现以下错误,
ResponseEntity<Response> responseEntity = restTemplate.exchange(endpointURL, HttpMethod.POST, requestEntity,
Response.class);
例外情况是:-
Exception in thread "main" javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"Response"). Expected elements are <{http://securetransport.dw/rcservice/xml}Response>
有什么方法可以跳过 Spring ResponseEntity 的命名空间检查?
【问题讨论】:
标签: java xml spring xsd resttemplate