Modify SOAP header Mustunderstand attribute in WCF client

◇◆丶佛笑我妖孽 提交于 2019-12-21 06:12:14

问题


I am writing a WCF client for a service (not WCF). Getting an error that Unprocessed 'mustUnderstand' header element: {http://www.w3.org/2005/08/addressing}Action, because request SOAP contains header with mustunderstand='true'. I have to either set it false or remove the whole header. can you show the way to do that?

Here is the binding code

var transportElement = new HttpsTransportBindingElement();
        transportElement.AuthenticationScheme = AuthenticationSchemes.Basic;

        var messegeElement = new TextMessageEncodingBindingElement();
        messegeElement.MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap11);

        var binding = new CustomBinding(messegeElement, transportElement);
        return binding;

回答1:


I resolved this one by setting AddressingVersion to None that did not put the SOAP headers.

here is the code

MessageVersion.CreateVersion(EnvelopeVersion.Soap11, AddressingVersion.None)



回答2:


Specifying the messageVersion solved my problem. <mtomMessageEncoding messageVersion="Soap12"/>



来源:https://stackoverflow.com/questions/4169798/modify-soap-header-mustunderstand-attribute-in-wcf-client

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