我不明白为什么以下XML(从WSDL请求构建)无效:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header />
<soap:Body xmlns:m="https://test.com/schemas/Plat/">
<m:TestRequest>
<m:transactId>TRANS_46151</m:transactId>
<m:param1>paramvalue1</m:param1>
</m:TestRequest>
</soap:Body>
</soap:Envelope>
为什么它会在&#34; m&#34;命名空间从&#34; TestRequest&#34;中删除参数如下:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header />
<soap:Body xmlns:m="https://test.com/schemas/Plat/">
<m:TestRequest>
<transactId>TRANS_46151</transactId>
<param1>paramvalue1</param1>
</m:TestRequest>
</soap:Body>
</soap:Envelope>
注意:XSD是:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema attributeFormDefault="qualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="https://test.com/schemas/Plat/"
<xsd:complexType name="EnteteMessageType">
<xsd:sequence>
<xsd:element name="transactId" type="xsd:string" minOccurs="0" />
<xsd:element name="param1" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
<xsd:element name="TestRequest" type="EnteteMessageType" />
</xsd:schema>
感谢您的帮助。
答案 0 :(得分:1)
可能是因为您尚未将元素表单指定为&#34; qualified&#34;:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema attributeFormDefault="qualified"
elementFormDefault="qualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="https://test.com/schemas/Plat/"
xmlns:tns="https://test.com/schemas/Plat/">
<xsd:complexType name="EnteteMessageType">
<xsd:sequence>
<xsd:element name="transactId" type="xsd:string" minOccurs="0" />
<xsd:element name="param1" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
<xsd:element name="TestRequest" type="tns:EnteteMessageType" />
</xsd:schema>