MessageHeader 類別

定義

表示 SOAP 標頭的內容。Represents the content of a SOAP header.

public ref class MessageHeader abstract : System::ServiceModel::Channels::MessageHeaderInfo
public abstract class MessageHeader : System.ServiceModel.Channels.MessageHeaderInfo
type MessageHeader = class
    inherit MessageHeaderInfo
Public MustInherit Class MessageHeader
Inherits MessageHeaderInfo
繼承
MessageHeader

備註

訊息標頭包含選擇性中繼資料,其中描述由 Message 類別所封裝的訊息。A message header contains optional metadata that describe a message encapsulated by the Message class.

Message 可以有零個或更多的標頭 (當做擴充機制使用),以便在應用程式特定的訊息中傳遞資訊。A Message can have zero or more headers that are used as an extension mechanism to pass information in messages that are application-specific. 您可以藉由呼叫 Headers 方法,使用 Add 將訊息標頭新增至訊息中。You can use Headers to add message headers to a message by calling the Add method.

Windows Communication Foundation (WCF)提供許多預先定義的訊息標頭,如下表所示。Windows Communication Foundation (WCF) provides a number of predefined message headers, as shown in the following table.

標頭名稱Header Name 說明Description
To 包含此訊息所針對的角色。Contains the role that the message is targeting.
動作Action 提供應該如何處理此訊息的說明。Provides a description of how the message should be processed.
FaultToFaultTo 包含錯誤應該傳送之目標節點的位址。Contains the address of the node to which faults should be sent.
From 包含傳送訊息之節點的位址。Contains the address of the node that sent the message.
要求Request 指出此訊息是否為要求。Indicates whether the message is a request.
MessageIDMessageID 包含此訊息的唯一 ID。Contains the unique ID of the message.
RelatesToRelatesTo 包含與此訊息相關之訊息的 ID。Contains the IDs of messages that are related to this message.
ReplyToReplyTo 包含應該針對要求傳送回覆之目標節點的位址。Contains the address of the node to which a reply should be sent for a request.

建構函式

MessageHeader()

初始化 MessageHeader 類別的新執行個體。Initializes a new instance of the MessageHeader class.

屬性

Actor

取得或設定訊息標頭的目標收件者。Gets or sets the targeted recipient of the message header.

IsReferenceParameter

取得值,這個值會指定此訊息標頭是否包含端點參考的參考參數。Gets a value that specifies whether this message header contains reference parameters of an endpoint reference.

MustUnderstand

取得或設定值,表示是否必須依照 SOAP 1.1/1.2 規格的說明來解讀標頭。Gets or sets a value that indicates whether the header must be understood, according to SOAP 1.1/1.2 specification.

Name

取得訊息標頭的名稱。Gets the name of the message header.

(繼承來源 MessageHeaderInfo)
Namespace

取得訊息標頭的命名空間。Gets the namespace of the message header.

(繼承來源 MessageHeaderInfo)
Relay

取得值,這個值會指出是否應該轉送標頭。Gets a value that indicates whether the header should be relayed.

方法

CreateHeader(String, String, Object)

使用指定的資料來建立新的訊息標頭。Creates a new message header with the specified data.

CreateHeader(String, String, Object, Boolean)

使用指定的資料來建立新的訊息標頭。Creates a new message header with the specified data.

CreateHeader(String, String, Object, Boolean, String)

使用指定的資料來建立新的訊息標頭。Creates a new message header with the specified data.

CreateHeader(String, String, Object, Boolean, String, Boolean)

使用指定的資料來建立新的訊息標頭。Creates a new message header with the specified data.

CreateHeader(String, String, Object, XmlObjectSerializer)

使用 XmlFormatter 從要序列化的物件建立標頭。Creates a header from an object to be serialized using the XmlFormatter.

CreateHeader(String, String, Object, XmlObjectSerializer, Boolean)

使用指定的資料來建立新的訊息標頭。Creates a new message header with the specified data.

CreateHeader(String, String, Object, XmlObjectSerializer, Boolean, String)

使用指定的資料來建立新的訊息標頭。Creates a new message header with the specified data.

CreateHeader(String, String, Object, XmlObjectSerializer, Boolean, String, Boolean)

使用指定的資料來建立新的訊息標頭。Creates a new message header with the specified data.

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetHashCode()

作為預設雜湊函數。Serves as the default hash function.

(繼承來源 Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
IsMessageVersionSupported(MessageVersion)

驗證是否支援指定的訊息版本。Verifies whether the specified message version is supported.

MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
OnWriteHeaderContents(XmlDictionaryWriter, MessageVersion)

當使用指定的 XML 寫入器序列化標頭內容時呼叫。Called when the header content is serialized using the specified XML writer.

OnWriteStartHeader(XmlDictionaryWriter, MessageVersion)

當使用指定的 XML 寫入器序列化開始標頭時呼叫。Called when the start header is serialized using the specified XML writer.

ToString()

傳回這個訊息標頭的字串表示。Returns the string representation of this message header.

WriteHeader(XmlDictionaryWriter, MessageVersion)

使用指定的 XML 寫入器序列化此標頭。Serializes the header using the specified XML writer.

WriteHeader(XmlWriter, MessageVersion)

使用指定的 XML 寫入器序列化此標頭。Serializes the header using the specified XML writer.

WriteHeaderAttributes(XmlDictionaryWriter, MessageVersion)

使用指定的 XML 寫入器序列化標頭屬性。Serializes the header attributes using the specified XML writer.

WriteHeaderContents(XmlDictionaryWriter, MessageVersion)

使用指定的 XML 寫入器序列化標頭內容。Serializes the header contents using the specified XML writer.

WriteStartHeader(XmlDictionaryWriter, MessageVersion)

使用指定的 XML 寫入器序列化開始標頭。Serializes the start header using the specified XML writer.

適用於