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);
      "---------------------------------- Response at " + DateTime.Now);     
   Stream myStream = myMessage.Stream;
   myStreamWriter.Write("Length of data in the current response: ");
   myNewStream.Position = 0;
   Copy(myNewStream, myFileStream);
   myNewStream.Position = 0;
   // Write the contents of the incoming SOAP message to the log file.
   void WriteInputBeforeDeserialize(SoapMessage* myMessage)
      Copy(myOldStream, myNewStream);
      FileStream* myFileStream =
         new FileStream(myFileName, FileMode::Append, FileAccess::Write);
      StreamWriter* myStreamWriter = new StreamWriter(myFileStream);
         S"---------------------------------- Response at {0}",__box(DateTime::Now));
      Stream* myStream = myMessage->Stream;
      myStreamWriter->Write(S"Length of data in the current response: ");
      myNewStream->Position = 0;
      Copy(myNewStream, myFileStream);
      myNewStream->Position = 0;

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

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.

.NET Framework

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

.NET Compact Framework

Supported in: 3.5, 2.0, 1.0