SoapExtension.ChainStream(Stream) 方法


当在派生类中被重写时,允许 SOAP 扩展访问包含 SOAP 请求或响应的内存缓冲区。When overridden in a derived class, allows a SOAP extension access to the memory buffer containing the SOAP request or response.

 virtual System::IO::Stream ^ ChainStream(System::IO::Stream ^ stream);
public virtual System.IO.Stream ChainStream (System.IO.Stream stream);
abstract member ChainStream : System.IO.Stream -> System.IO.Stream
override this.ChainStream : System.IO.Stream -> System.IO.Stream



包含 SOAP 请求或响应的内存缓冲区。A memory buffer containing the SOAP request or response.


Stream,它表示此 SOAP 扩展可以修改的新内存缓冲区。A Stream representing a new memory buffer that this SOAP extension can modify.


以下示例将保存这两Stream传递到ChainStreamStream从返回ChainStream中的成员变量oldStreamnewStream分别。The following example saves both the Stream passed into ChainStream and the Stream returned from ChainStream in the member variables oldStream and newStream, respectively.

   virtual Stream^ ChainStream( Stream^ stream ) override
      oldStream = stream;
      newStream = gcnew MemoryStream;
      return newStream;
public override Stream ChainStream( Stream stream ){
    oldStream = stream;
    newStream = new MemoryStream();
    return newStream;
Public Overrides Function ChainStream(stream As Stream) As Stream
    m_oldStream = stream
    m_newStream = New MemoryStream()
    Return m_newStream
End Function


ChainStream 确保具有最高优先级的 SOAP 扩展可以修改 SOAP 消息发送或通过网络返回最接近的实际数据。ChainStream ensures that SOAP extensions with the highest priority can modify the actual data closest to the SOAP message sent or returned over the wire.

SOAP 扩展应保存的引用Stream传递到ChainStreamStream从返回ChainStreamSOAP extensions should save references of the Stream passed into ChainStream and the Stream returned from ChainStream. 如果 SOAP 扩展配置为使用 XML Web 服务方法,运行Stream传递到ChainStream包含在序列化的 SOAP 请求BeforeDeserialize SoapMessageStageIf the SOAP extension is configured to run with a XML Web service method, the Stream passed into ChainStream contains the serialized SOAP request at the BeforeDeserializeSoapMessageStage. 同样,Stream返回从引用ChainStream时序列化时发生,因此包含序列化的 SOAP 响应中写入AfterSerialize SoapMessageStageSimilarly, the Stream reference returned from ChainStream is written into when the serialization occurs and thus contains the serialized SOAP response in the AfterSerializeSoapMessageStage.