MustUnderstand Property
Collapse the table of content
Expand the table of content

MessageHeaderAttribute.MustUnderstand Property

Specifies whether the node acting in the Actor role must understand this header. This is mapped to the mustUnderstand SOAP header attribute.

Namespace:  System.ServiceModel
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public bool MustUnderstand { get; set; }

Property Value

Type: System.Boolean
true if the node acting in the Actor role must understand this header; otherwise, false.

For more information, see the Remarks section of MessageHeaderAttribute for details.

Important noteImportant

It is important to remember that if the MustUnderstand property is true in a message being sent and the application on the receiving side does not understand the header a fault is generated. Conversely, if a header with the mustUnderstand SOAP header attribute set to true is received by , it must be a part of the message contract (or must be processed by one of the channels); otherwise, it is assumed that the header is not understood and an exception is thrown.

The following code example shows the use of the MessageHeaderAttribute to create a SOAP header for the response message with the Name, Namespace and MustUnderstand properties set to values appropriate for this header. The code example is followed by an example of the message when sent.

 public class HelloResponseMessage
   private string localResponse = String.Empty;
   private string extra = String.Empty;

     Name = "ResponseToGreeting",
     Namespace = "")]
   public string Response
     get { return localResponse; }
     set { localResponse = value; }

     Name = "OutOfBandData",
     Namespace = "",
   public string ExtraValues
     get { return extra; }
     set { this.extra = value; }

   The following is the response message, edited for clarity.

       <a:Action s:mustUnderstand="1">http://HelloResponseMessage/Action</a:Action>
       <h:OutOfBandData s:mustUnderstand="1" xmlns:h="">Served by object 13804354.</h:OutOfBandData>
       <HelloResponseMessage xmlns="Microsoft.WCF.Documentation">
         <ResponseToGreeting xmlns="">Service received: Hello.</ResponseToGreeting>

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

© 2016 Microsoft