我在SOAP響應驗證中遇到了一個奇怪的問題。我已經將響應和XSD降低到重現錯誤所需的最低限度。該XSD:XSD驗證期望它抱怨的元素
<?xml version="1.0"?>
<xs:schema targetNamespace="http://peoplesoft.com/rootResponse" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="ReturnID" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
SOAP響應:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<root xmlns="http://peoplesoft.com/rootResponse">
<ReturnID />
</root>
</soapenv:Body>
</soapenv:Envelope>
如果我在驗證soapUI的原始響應,它說:預計元素 'ReturnID' 而不是「ReturnID @ HTTP://peoplesoft.com/rootResponse'元素root @ http://peoplesoft.com/rootResponse。
當我在Visual Studio 2012中加載上述文件(是的,我告訴Visual Studio使用這個XSD文件來驗證命名空間)時,我得到這個:命名空間'http://'中的元素'root' peoplesoft.com/rootResponse'在'http://peoplesoft.com/rootResponse'命名空間中有無效的子元素'ReturnID'。預期的可能元素列表:'ReturnID'。
在這兩種情況下,它的嘎嘎叫有關ReturnID元素,但它說,它預計ReturnID元素?
就是這樣!謝謝! –