Custom SOAP 1.1 header and mustUnderstand attribute

非 Y 不嫁゛ 提交于 2019-12-10 21:27:37

问题


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>

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>

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.

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


回答1:


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



来源:https://stackoverflow.com/questions/9516053/custom-soap-1-1-header-and-mustunderstand-attribute

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!