Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Message::CreateMessage Method (XmlReader, Int32, MessageVersion)

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

Namespace:  System.ServiceModel.Channels
Assemblies:   System.ServiceModel.Primitives (in System.ServiceModel.Primitives.dll)
  System.ServiceModel (in System.ServiceModel.dll)

public:
static Message^ CreateMessage(
	XmlReader^ envelopeReader, 
	int maxSizeOfHeaders, 
	MessageVersion^ version
)

Parameters

envelopeReader
Type: System.Xml::XmlReader

The XmlReader 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 MessageVersion object that specifies the SOAP version to use for the message.

Return Value

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

ExceptionCondition
ArgumentNullException

envelopeReader or version is nullptr.

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

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft