自定义SOAP 1.1标头和mustUnderstand属性 [英] Custom SOAP 1.1 header and mustUnderstand attribute

查看:377
本文介绍了自定义SOAP 1.1标头和mustUnderstand属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Web服务(与SOAP 1.1规范兼容)使用其自身类型的标头 MyHeader 在xsd中定义,如下所示:

My WebService (compilant with SOAP 1.1 specification) uses its own type of header MyHeader defined within the xsd as follows:

<xs:complexType name="MyHeader">
    <xs:sequence>
       <xs:element name="MyElement1" type="xs:string"></xs:element>
       <xs:element name="MyElement2" type="xs:string"></xs:element>
    </xs:sequence>
</xs:complexType>

不幸的是,由AXIS 1.4框架"生成的SAOP消息具有 MyHeader 元素,其中包含 mustUnderstand ="0" 属性:

Unfortunately SAOP message generated "by AXIS 1.4 framework" has MyHeader element containing mustUnderstand="0" attribute:

<ns:MyHeader soapenv:mustUnderstand="0" xmlns:ns="http://....">
   <ns:MyElement1>XXX</ns:MyElement1>
   <ns:MyElement2>YYY</ns:MyElement2>
</ns:MyHeader>

根据SOAP规范 mustUnderstand 可以添加到每个标头中.但是,在我看来,如此定义的元素 MyHeader 不能包含此属性,因为生成的XML与XML规范不兼容-它不能针对 cvc-复杂类型.

According to specification SOAP mustUnderstand can be added to each header. However, it seems to me that the so-defined elements MyHeader can not contain this attribute, because the resulting XML is incompatible with the XML specification - it does not valide against XML rules of cvc-complex-type.

是否允许向此标头实例添加 mustUnderstand 属性? AXIS Framework 1.4是否正常工作?

Is it allowed to add mustUnderstand attribute to this header instance? Does AXIS framework 1.4 works properly?

推荐答案

长话短说,请搜索从标头中删除mustUnderstand属性",这样可以为您提供解决方案;默认情况下,不应添加此标头;如果您需要实际使用它,那么我将修改标头部分的架构以包括这些SOAP属性;如果您想查看示例,请查看 WS-I Claim模式(删除use ="prohibited").

To keep a long story short, please search for "removing mustUnderstand attribute from headers" and that should get you the solution; by default, this header shouldn't be added; if you have a need to actually use it, then I would modify your schema for the header part to include these SOAP attributes; if you want to see an example, please take a look at WS-I Claim schema (remove use="prohibited").

这篇关于自定义SOAP 1.1标头和mustUnderstand属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆