肥皂结果的 XSD 不起作用 [英] XSD for soap result not working
本文介绍了肥皂结果的 XSD 不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想检查对 xsd 的肥皂响应.这是 xml 肥皂响应:
I want to check a soap response against a xsd. Here is the xml soap response:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetHTMLResponse xmlns="http://www.webserviceX.NET">
<GetHTMLResult>
Test
</GetHTMLResult>
</GetHTMLResponse>
</soap:Body>
</soap:Envelope>
这是我的 XSD:
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import namespace="http://schemas.xmlsoap.org/soap/envelope/" schemaLocation="http://schemas.xmlsoap.org/soap/envelope/"/>
<xs:element name="GetHTMLResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="GetHTMLResult" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
我收到此错误:Cvc-elt.1:找不到元素soap:Envelope"的声明.
为什么会这样?
推荐答案
尝试根据以下 XSD 文件检查 SOAP 响应.我为存在于 SOAP 响应中的外部
和
标记添加了元素.
Try checking the SOAP response against the following XSD file. I added elements for the outer <soap:Envelope>
and <soap:Body>
tags which are present in the SOAP response.
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.org"
xmlns:tns="http://www.w3.org/2003/05/soap-envelope">
<xs:element name="Envelope" type="tns:envType">
<xs:complexType name="envType">
<xs:sequence>
<xs:element name="Body" type="tns:bodyType">
<xs:complexType name="bodyType">
<xs:sequence>
<xs:element name="GetHTMLResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="GetHTMLResult" minOccurs="0"
maxOccurs="1" type="xs:string">
<xs:simpleType>
<xs:restriction base="xs:string">
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
这篇关于肥皂结果的 XSD 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文