web-services - 如何在 WSDL 中将 SOAP header 标记为可选?

标签 web-services soap wsdl tibco

我有一个带有可选标题的 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/

相关文章:

java - Spring WS如何获取服务器端soap响应xml以添加带符号的soap header

php - 使用 PHP 调用 Python 网络服务

soap - Paypal 自适应付款响应非常慢

python - 从 WSDL 文件显式生成自动完成代码?

java - 如何从使用现有 XSD 类型的 WSDL 构建 Java

java - org.apache.axis.wsdl.toJava.DuplicateFileException : Duplicate file name:

android - 使用 KSOAP 的 Web 服务

java - 验证 SOAP 消息的签名

Java webservices - 在请求 header 中发送对象

java - JAX-WS 返回空列表