Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/338.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在RestTemplate中解组期间忽略xml命名空间_Java_Xml_Spring_Xsd_Resttemplate - Fatal编程技术网

Java 在RestTemplate中解组期间忽略xml命名空间

Java 在RestTemplate中解组期间忽略xml命名空间,java,xml,spring,xsd,resttemplate,Java,Xml,Spring,Xsd,Resttemplate,我通过SpringRestTemplate通过HTTP请求将XML发送到外部网关,并收到一个XML响应 用于验证响应的XSD具有目标命名空间,但实际响应不包含命名空间前缀。我已经使用XSD生成了Java资源,因此在从(解组过程中)获取响应时会出现以下错误 ResponseEntity ResponseEntity=restemplate.exchange(endpointURL、HttpMethod.POST、requestEntity、, 答复(类别); 例外情况是:- Exception

我通过SpringRestTemplate通过HTTP请求将XML发送到外部网关,并收到一个XML响应

用于验证响应的XSD具有目标命名空间,但实际响应不包含命名空间前缀。我已经使用XSD生成了Java资源,因此在从(解组过程中)获取响应时会出现以下错误

ResponseEntity ResponseEntity=restemplate.exchange(endpointURL、HttpMethod.POST、requestEntity、,
答复(类别);
例外情况是:-

Exception in thread "main" javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"Response"). Expected elements are <{http://securetransport.dw/rcservice/xml}Response>
线程“main”javax.xml.bind.unmarshaleException中的异常:意外元素(uri:,local:“Response”)。预期的要素是
有没有办法跳过Spring ResponseEntity中的名称空间检查?

如果您使用jaxb插件生成了绑定,那么应该有一个“package info.java”

例如:

@javax.xml.bind.annotation.XmlSchema(namespace=“someurl”,elementFormDefault=javax.xml.bind.annotation.XmlNsForm.QUALIFIED)

如果从注释中删除名称空间,它应该可以工作

Exception in thread "main" javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"Response"). Expected elements are <{http://securetransport.dw/rcservice/xml}Response>