Export (0) Print
Expand All

SoapMessage.Stream Property

Gets the data representing the SOAP request or SOAP response in the form of a Stream.

Namespace:  System.Web.Services.Protocols
Assembly:  System.Web.Services (in System.Web.Services.dll)

public Stream Stream { get; }

Property Value

Type: System.IO.Stream
A read-only instance of the Stream class.

SOAP extensions that inspect the data representing a SOAP request or SOAP response, such as a logging SOAP extension, can use the Stream property to view the data at each SoapMessageStage.

SOAP extensions that modify the data representing a SOAP request or SOAP response, such as encryption or compression SOAP extensions, should do so with the Stream passed into the ChainStream method of SoapExtension. The Stream property of SoapMessage passed into ProcessMessage is read-only.

For more information on modifying the data representing a SOAP request or SOAP response, see ChainStream.


// Write the contents of the incoming SOAP message to the log file.
public void WriteInputBeforeDeserialize(SoapMessage myMessage)
{
   Copy(myOldStream, myNewStream);
   FileStream myFileStream = 
      new FileStream(myFileName, FileMode.Append, FileAccess.Write);
   StreamWriter myStreamWriter = new StreamWriter(myFileStream);
   myStreamWriter.WriteLine(
      "---------------------------------- Response at " + DateTime.Now);     
   Stream myStream = myMessage.Stream;
   myStreamWriter.Write("Length of data in the current response: ");
   myStreamWriter.WriteLine(myStream.Length);
   myStreamWriter.Flush();
   myNewStream.Position = 0;
   Copy(myNewStream, myFileStream);
   myStreamWriter.Close();
   myFileStream.Close();
   myNewStream.Position = 0;
}


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft