加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

Web服务 – 如何在WSDL中将SOAP标头标记为可选的?

发布时间:2020-12-14 21:32:00 所属栏目:资源 来源:网络整理
导读:我有一个带有可选标题的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:co
我有一个带有可选标题的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.AuthIdentifier>
   <ns0:AuthIdentifier xmlns:ns0 = "http://www.tal.com/schemas"/>
</Header.AuthIdentifier>

如何使其可选?所以他根本不用发送整个标题?有没有minOccurs或类似的东西?还是现在已经是可选的了?

解决方法

根据“Web服务合同设计与版本控制”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标头块中设置属性wsdl:required =“false”,以指示消费者是否必须包含此标头块。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读