使用https://www.freeformatter.com/xml-validator-xsd.html
如果我将 soapenf 完全从响应和模式中的混合中取出,它可以正常工作,但我想两者都做。
(仅供参考,我想指出这个 wsdl 和 xsd 没有暴露在端点上,CISCO 提供了 wsdl 的 zip 文件和 xsd 文件)然后您可以通过 wsdl/xsd 向服务器发送请求,它会起作用。但是 wsdl 和 xsd 在 cisco.com 或您安装了该服务的 vm 或域上不可用)
如果我指向文件,这在 c# 中非常有效,但我想将 xml 文档加载到 NSXMLDocument 变量文档中并让它指向它自己的 schemaFile 并调用 validate
我有以下肥皂 xml
<?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>
我从 cisco 提供的 xsd 文件中提取了最少的内容,并且在线工具可以使用
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:axlapi="http://www.cisco.com/AXL/API/10.5"
attributeFormDefault="unqualified" elementFormDefault="unqualified"
targetNamespace="http://www.cisco.com/AXL/API/10.5" version="10.5">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/envelope/" schemaLocation="http://schemas.xmlsoap.org/soap/envelope/"/>
<xsd:complexType name="GetCCMVersionRes">
<xsd:complexContent>
<xsd:extension base="axlapi:APIResponse">
<xsd:sequence>
<xsd:element name="return">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="componentVersion">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="version" type="axlapi:String50"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="getCCMVersionResponse" type="axlapi:GetCCMVersionRes"/>
<xsd:simpleType name="String50">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="50"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType abstract="true" name="APIResponse">
<xsd:annotation>
<xsd:documentation>All responses must extend abstractResponse.</xsd:documentation>
</xsd:annotation>
<xsd:attribute name="sequence" type="xsd:unsignedLong" use="optional"/>
</xsd:complexType>
</xsd:schema>
请注意,我必须在 xsd 文件中添加以下内容才能通过 SOAP 错误
<xsd:import namespace="http://schemas.xmlsoap.org/soap/envelope/" schemaLocation="http://schemas.xmlsoap.org/soap/envelope/"/>
它适用于在线工具
现在这对于一个在线工具来说非常棒,但我想验证文档本身。这是通过添加到 Soap 请求信封元素“noNamespaceSchemaLocation”或“schemaLocation”以及 xsd 文件(或我在上面创建的部分文件)的 http 路径来完成的(如果您阅读了在线工具)
我已经尝试了各种使用在线工具的方法,但它永远不会验证。它目前托管在http://test123a.epizy.com/getCCMVersion.xsd(我希望它不是因为它是一个免费的主机,我有问题),但也应该有办法使用 file:///
我正在使用 macOS 和objective-c,但所有代码都在做,正在操作soap xml 响应标头,并放置file:/// 的位置。我也试过http://。
谁能解开这个绝对的谜团?从网上的一些例子来看,这似乎很简单......
在 Cocoa 中使用 xsd 文件验证 XML Schema?
http://answerqueen.com/2j/q7vz0zv32j
如何修复soapenv:XSD模式中的信封问题,同时使用SOAP请求/响应进行验证
https://code.i-harness.com/en/q/8bfd7
Cvc-elt.1:找不到元素“soap:Envelope”的声明
提前谢谢你的帮助
这家伙从来没有得到答案SOAP 响应模式验证