WS-I BP2012断言是什么意思?

PCo*_*der 2 wsdl web-services ws-i

有人可以解释这实际意味着什么吗?一个例子真的很有帮助.

WS-I:(BP2012)文档 - 文字绑定包含soapbind:body元素,它们引用没有element属性的消息部分元素.

DRH*_*DRH 8

此消息与WS-I Basic Profile相关,后者试图阐明WSDL的子集以及通常可互操作的其他规范.

在这种情况下,BP2012与以下内容相关联:

描述中的文档 - 文字绑定必须在其每个wsoap12:body元素中仅引用已使用element属性定义的wsdl:part元素.

如果您的Web服务中使用的其中一条消息是以a type而不是a 来定义的,通常会看到这种情况element,例如:

<wsdl:message name="MyMessage">
    <wsdl:part name="MyPart" type="xsd:string"/>
</wsdl:message>
Run Code Online (Sandbox Code Playgroud)

要解决此问题,您需要更改消息,以便根据以下part内容定义element:

<wsdl:types>
    <xsd:schema targetNamespace="http://www.example.com/"
        xmlns:xsd="http://www.w3.org/1999/XMLSchema">
        <xsd:element name="MyElement" type="xsd:string"/>
    </xsd:schema>
</wsdl:types>

<wsdl:message name="MyMessage">
    <wsdl:part name="MyPart" element="tns:MyElement" xmlns:tns="http://www.example.com/"/>
</wsdl:message>
Run Code Online (Sandbox Code Playgroud)

或者,您可能希望将Web服务从使用document/literal绑定切换为使用rpc/literal绑定.使用rpc/literal绑定,部分是用a type而不是a 来定义的element.