自定义SOAP 1.1头和mustUnderstand属性

时间:2022-09-07 17:18:15

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

我的WebService(使用SOAP 1.1规范编译)使用自己在xsd中定义的header MyHeader类型,如下所示:

<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>

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

不幸的是,由“AXIS 1.4框架”生成的SAOP消息的MyHeader元素包含mustUnderstand=“0”属性:

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

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.

根据规范,可以将SOAP mustUnderstand添加到每个头中。但是,在我看来,这个定义为so的元素MyHeader不能包含这个属性,因为生成的XML与XML规范不兼容——它不能验证cvc-complex类型的XML规则。

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

是否允许向这个头实例添加mustUnderstand属性?AXIS框架1.4工作正常吗?

1 个解决方案

#1


0  

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").

长话短说,请搜索“从标题中删除mustUnderstand属性”,这将为您提供解决方案;默认情况下,不应该添加这个头;如果您确实需要使用它,那么我将修改头部分的模式,以包含这些SOAP属性;如果您希望看到一个示例,请查看WS-I Claim schema(删除使用=“禁止”)。

#1


0  

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").

长话短说,请搜索“从标题中删除mustUnderstand属性”,这将为您提供解决方案;默认情况下,不应该添加这个头;如果您确实需要使用它,那么我将修改头部分的模式,以包含这些SOAP属性;如果您希望看到一个示例,请查看WS-I Claim schema(删除使用=“禁止”)。