3

查看 SOAP 1.1 规范 ( http://www.w3.org/TR/2000/NOTE-SOAP-20000508/ ) 和相应的 XSD ( http://schemas.xmlsoap.org/soap/envelope/ ),我可以看到关于encodingStyle属性的不匹配。

这个 W3C 说明中有很多例子,展示了encodingStyle属性的用法,例如:

<SOAP-ENV:Envelope
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
   <SOAP-ENV:Body>
       <m:GetLastTradePrice xmlns:m="Some-URI">
           <symbol>DIS</symbol>
       </m:GetLastTradePrice>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

此外,第 4.1.1 节说:

The SOAP encodingStyle global attribute can be used to indicate the serialization rules 
used in a SOAP message. This attribute MAY appear on any element, and is scoped to that
element's contents and all child elements not themselves containing such an attribute, 
much as an XML namespace declaration is scoped. 

但是,XSD不允许在信封和标题元素中使用encodingStyle属性:

<xs:complexType name="Envelope">
    <xs:sequence>
        <xs:element ref="tns:Header" minOccurs="0"/>
        <xs:element ref="tns:Body" minOccurs="1"/>
        <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
    </xs:sequence>
    <xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>

如您所见,有一个 XSD 通配符“##other”,表示允许来自 OTHER THAN 目标命名空间的任何属性。但是,示例中的目标命名空间是相同的,因此示例不应该是有效的。做一个快速测试也可以验证这一点:尝试验证包含这个soap示例的xml文档将导致失败(在Intellij Idea中测试)。

谁能告诉我,W3C 注释、XSD 中是否有错误,或者我遗漏了什么?提前致谢。

4

0 回答 0