MessageHeaderAttribute.MustUnderstand Özellik
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Rolde davranan düğümün Actor bu üst bilgiyi anlayıp anlamayacağını belirtir. Bu, SOAP üst bilgi özniteliğine mustUnderstand eşlenir.
public:
property bool MustUnderstand { bool get(); void set(bool value); };
public bool MustUnderstand { get; set; }
member this.MustUnderstand : bool with get, set
Public Property MustUnderstand As Boolean
Özellik Değeri
true rolünde hareket eden düğümün Actor bu üst bilgiyi anlaması gerekiyorsa, aksi takdirde , false.
Örnekler
Aşağıdaki kod örneğinde , ve NameNamespaceMustUnderstand özellikleri bu üst bilgi için uygun değerlere ayarlanmış yanıt iletisi için soap üst bilgisi oluşturmak için kullanımı MessageHeaderAttribute gösterilmektedir. Kod örneğinin ardından gönderildiğinde iletinin bir örneği gösterilir.
[MessageContract]
public class HelloResponseMessage
{
private string localResponse = String.Empty;
private string extra = String.Empty;
[MessageBodyMember(
Name = "ResponseToGreeting",
Namespace = "http://www.examples.com")]
public string Response
{
get { return localResponse; }
set { localResponse = value; }
}
[MessageHeader(
Name = "OutOfBandData",
Namespace = "http://www.examples.com",
MustUnderstand=true
)]
public string ExtraValues
{
get { return extra; }
set { this.extra = value; }
}
/*
The following is the response message, edited for clarity.
<s:Envelope>
<s:Header>
<a:Action s:mustUnderstand="1">http://HelloResponseMessage/Action</a:Action>
<h:OutOfBandData s:mustUnderstand="1" xmlns:h="http://www.examples.com">Served by object 13804354.</h:OutOfBandData>
</s:Header>
<s:Body>
<HelloResponseMessage xmlns="Microsoft.WCF.Documentation">
<ResponseToGreeting xmlns="http://www.examples.com">Service received: Hello.</ResponseToGreeting>
</HelloResponseMessage>
</s:Body>
</s:Envelope>
*/
}
<MessageContract> _
Public Class HelloResponseMessage
Private localResponse As String = String.Empty
Private extra As String = String.Empty
<MessageBodyMember(Name := "ResponseToGreeting", Namespace := "http://www.examples.com")> _
Public Property Response() As String
Get
Return localResponse
End Get
Set(ByVal value As String)
localResponse = value
End Set
End Property
<MessageHeader(Name := "OutOfBandData", Namespace := "http://www.examples.com", MustUnderstand:=True)> _
Public Property ExtraValues() As String
Get
Return extra
End Get
Set(ByVal value As String)
Me.extra = value
End Set
End Property
'
' The following is the response message, edited for clarity.
'
' <s:Envelope>
' <s:Header>
' <a:Action s:mustUnderstand="1">http://HelloResponseMessage/Action</a:Action>
' <h:OutOfBandData s:mustUnderstand="1" xmlns:h="http://www.examples.com">Served by object 13804354.</h:OutOfBandData>
' </s:Header>
' <s:Body>
' <HelloResponseMessage xmlns="Microsoft.WCF.Documentation">
' <ResponseToGreeting xmlns="http://www.examples.com">Service received: Hello.</ResponseToGreeting>
' </s:Body>
' </s:Envelope>
'
End Class
Açıklamalar
Daha fazla bilgi için ayrıntılar için öğesinin MessageHeaderAttribute Açıklamalar bölümüne bakın.
Önemli
Özellik gönderilen bir iletideyse true ve alıcı tarafındaki uygulamanın üst bilgiyi anlamaması durumunda MustUnderstand bir hatanın oluşturulduğunu unutmamanız önemlidir. Buna karşılık, SOAP üst bilgisi özniteliği ayarlanmış true bir üst bilgi mustUnderstand Windows Communication Foundation (WCF) tarafından alınırsa, ileti sözleşmesinin bir parçası olmalıdır (veya Windows Communication Foundation (WCF) kanallarından biri tarafından işlenmelidir); aksi takdirde, üst bilginin anlaşılmadığı ve bir özel durum oluştuğu varsayılır.