验证任何语言的 XML 响应,而无需引用两个基于文件的 xml 和 xsd 文档



我有一个SOAP xml响应。

我有一个 xsd 文件。

但是有没有办法在 SOAP xml 响应的标头中注入 xsd 架构文件的位置,并只验证 XMLDocument

这是我想出的,但就是不起作用

<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns:getCCMVersionResponse xmlns:ns="http://www.cisco.com/AXL/API/10.5"> 
<return><componentVersion>     
<version>10.5.2.11900(3)</version>
</componentVersion>
</return>
</ns:getCCMVersionResponse>
</soapenv:Body>
</soapenv:Envelope>

IM 试图更改标头

xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://test123a.epizy.com/getCCMVersion.xsd">

我尝试过模式位置,我也尝试过 file:///Users/me/Documents/getCCMVersion.xsd

谁能帮忙?

这家伙从来没有得到过

SOAP 响应架构验证

<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    
xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/   
http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns:getCCMVersionResponse xmlns:ns="http://www.cisco.com/AXL/API/10.5"                                                       
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"                                              
xsi:schemaLocation="http://www.cisco.com/AXL/API/10.5  
/Users/michael/Downloads/axlsqltoolkit/schema/current/getCCMVersion.xsd">
<return>
<componentVersion>
<version>10.5.2.11900(3)</version>
</componentVersion>
</return>
</ns:getCCMVersionResponse>
</soapenv:Body>
</soapenv:Envelope>

事实证明这是正确的格式

但是,不能同时对 SOAP 文档和 SOAP 中的 XML 进行自我验证。

您将需要路径到

此外,如果 xml 响应或 soap 甚至 lope 已经声明了命名空间,则无法使用 noNamespaceSchemaLocation。 例如,xml 响应已经具有

xmlns:ns="http://www.cisco.com/AXL/API/10.5"

并且在那里进行所有尝试,只有挫败感

<version>10.5.2.11900(3)</version>
</componentVersion>
</return>
</ns:getCCMVersionResponse>
</soapenv:Body>

相关内容

最新更新