Message.CreateMessage Method (XmlDictionaryReader, Int32, MessageVersion) (System.ServiceModel.Channels)

Switch View :
ScriptFree
.NET Framework Class Library
Message.CreateMessage Method (XmlDictionaryReader, Int32, MessageVersion)

Creates a message using the specified reader, action and version.

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

Visual Basic (Declaration)
Public Shared Function CreateMessage ( _
	envelopeReader As XmlDictionaryReader, _
	maxSizeOfHeaders As Integer, _
	version As MessageVersion _
) As Message
Visual Basic (Usage)
Dim envelopeReader As XmlDictionaryReader
Dim maxSizeOfHeaders As Integer
Dim version As MessageVersion
Dim returnValue As Message

returnValue = Message.CreateMessage(envelopeReader, _
	maxSizeOfHeaders, version)
C#
public static Message CreateMessage(
	XmlDictionaryReader envelopeReader,
	int maxSizeOfHeaders,
	MessageVersion version
)
Visual C++
public:
static Message^ CreateMessage(
	XmlDictionaryReader^ envelopeReader, 
	int maxSizeOfHeaders, 
	MessageVersion^ version
)
JScript
public static function CreateMessage(
	envelopeReader : XmlDictionaryReader, 
	maxSizeOfHeaders : int, 
	version : MessageVersion
) : Message

Parameters

envelopeReader
Type: System.Xml.XmlDictionaryReader
The XmlDictionaryReader object to be used for reading the SOAP message.
maxSizeOfHeaders
Type: System.Int32
The maximum size in bytes of a header.
version
Type: System.ServiceModel.Channels.MessageVersion
A valid MessageVersion value that specifies the SOAP version to use for the message.

Return Value

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

Exception Condition
ArgumentNullException

envelopeReader or version is null.

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.

.NET Framework Security

Platforms

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information

.NET Framework

Supported in: 3.5, 3.0
See Also

Reference