共用方式為


SoapMessage.Stream 屬性

定義

取得以 Stream 形式表示的 SOAP 要求或 SOAP 回應的資料。

public:
 property System::IO::Stream ^ Stream { System::IO::Stream ^ get(); };
public System.IO.Stream Stream { get; }
member this.Stream : System.IO.Stream
Public ReadOnly Property Stream As Stream

屬性值

Stream 類別的唯讀執行個體。

範例

   // Write the contents of the incoming SOAP message to the log file.
public:
   void WriteInputBeforeDeserialize( SoapMessage^ myMessage )
   {
      Copy( myOldStream, myNewStream );
      FileStream^ myFileStream =
         gcnew FileStream( myFileName, FileMode::Append, FileAccess::Write );
      StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream );
      myStreamWriter->WriteLine(
         "---------------------------------- Response at {0}", 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;
   }
// 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;
}
' Write the contents of the incoming SOAP message to the log file.
Public Sub WriteInputBeforeDeserialize(myMessage As SoapMessage)
   Copy(myOldStream, myNewStream)
   Dim myFileStream As _
      New FileStream(myFileName, FileMode.Append, FileAccess.Write)
   Dim myStreamWriter As New StreamWriter(myFileStream)
   myStreamWriter.WriteLine( _
      "---------------------------------- Response at " + DateTime.Now)
   Dim myStream As Stream = 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
End Sub

備註

檢查代表 SOAP 要求或 SOAP 回應之資料的 SOAP 延伸模組,例如記錄 SOAP 延伸模組,可以使用 Stream 屬性來檢視每個 SoapMessageStage 的資料。

修改代表 SOAP 要求或 SOAP 回應之資料的 SOAP 延伸模組,例如加密或壓縮 SOAP 延伸模組,應該使用 Stream 傳遞至 ChainStream 的 方法 SoapExtension 來執行此動作。 Stream傳入 ProcessMessageSoapMessage 屬性是唯讀的。

如需修改代表 SOAP 要求或 SOAP 回應之資料的詳細資訊,請參閱 ChainStream

適用於