Message.CreateMessage Method (XmlDictionaryReader, Int32, MessageVersion)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Creates a message using a specified dictionary reader, size allocation for the message headers, and version.

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

Syntax

'Declaration
Public Shared Function CreateMessage ( _
    envelopeReader As XmlDictionaryReader, _
    maxSizeOfHeaders As Integer, _
    version As MessageVersion _
) As Message
public static Message CreateMessage(
    XmlDictionaryReader envelopeReader,
    int maxSizeOfHeaders,
    MessageVersion version
)

Parameters

  • maxSizeOfHeaders
    Type: System.Int32
    The maximum size in bytes of the message headers.

Return Value

Type: System.ServiceModel.Channels.Message
A Message object for the message created.

Exceptions

Exception Condition
ArgumentNullException

envelopeReader or version is nulla null reference (Nothing in Visual Basic).

Remarks

Message takes ownership of envelopeReader.

This method reads the envelope, buffers all the headers into the header collection, and reads up to but not including the Body start tag, and returns the message. If the method call throws an exception, it closes the reader.

The body of the returned message can then be either read or written.

The message body can be read using the GetBody methods on the returned message. The returned object encapsulates all the child elements within the Body element. The message body can be written using WriteBody or WriteMessage. Once written, it cannot be read.

Closing the message closes the underlying envelope reader.

Version Information

Silverlight

Supported in: 5, 4

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.