我有一个带有可选标题的 wsdl:
<s:element name="AuthIdentifier" type="tns:AuthIdentifier"/>
<s:complexType name="AuthIdentifier">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="identifier" type="s:string"/>
</s:sequence>
<s:anyAttribute/>
</s:complexType>
客户端正在使用集成软件
(tibco)
连接到我的服务并声称需要 header ,因此他必须使用空值发送它:<Header.AuthIdentifier>
<ns0:AuthIdentifier xmlns:ns0 = "http://www.tal.com/schemas"/>
</Header.AuthIdentifier>
我如何使它成为可选的?这样他就不必发送整个标题了?有没有
minOccurs
或类似的东西?或者它已经是可选的了?
最佳答案
根据“Web Service Contract Design & Versioning” Thomas Erl 等人 (ISBN-13: 978-0-13-613517-3) 第 15.4 章,在 WSDL 中定义 SOAP 块:
The WSDL 1.1 Specification is unclear about whether SOAP headers described in a WSDL document must be included by consumers or not. The WS-I Basic Profile made it mandatory for consumers to include them, but WDL 2.0 provides the choice as to whether consumers should be forced to include them or not. Page 472.
在 WSDL 2.0 中,您可以在自定义 SOAP header 块中设置属性 wsdl:required="false"以指示使用者是否必须包含此 header 块。
关于web-services - 如何在 WSDL 中将 SOAP header 标记为可选?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34920717/