Export (0) Print
Expand All

SoapExtension.ChainStream Method

When overridden in a derived class, allows a SOAP extension access to the memory buffer containing the SOAP request or response.

[Visual Basic]
Public Overridable Function ChainStream( _
   ByVal stream As Stream _
) As Stream
[C#]
public virtual Stream ChainStream(
 Stream stream
);
[C++]
public: virtual Stream* ChainStream(
 Stream* stream
);
[JScript]
public function ChainStream(
   stream : Stream
) : Stream;

Parameters

stream
A memory buffer containing the SOAP request or response.

Return Value

A Stream representing a new memory buffer that this SOAP extension can modify.

Remarks

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. For instance, you probably would not want a compression SOAP extension to compress the data prior to an encryption SOAP extension encrypted the data. Doing so might lead to an inefficiently compressed data packet sent over the wire.

SOAP extensions should save references of the Stream passed into ChainStream and the Stream returned from ChainStream. If 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 BeforeDeserialize SoapMessageStage. Similarily, the Stream reference returned from ChainStream is written into when the serialization occurs and thus contains the serialized SOAP response in the AfterSerialize SoapMessageStage.

Example

[Visual Basic, C#, C++] The following example saves both the Stream passed into ChainStream and the Stream returned from ChainStream in the member variables oldStream and newStream, respectively.

[Visual Basic] 
Public Overrides Function ChainStream(stream As Stream) As Stream
    m_oldStream = stream
    m_newStream = New MemoryStream()
    Return m_newStream
End Function

[C#] 
public override Stream ChainStream( Stream stream ){
    oldStream = stream;
    newStream = new MemoryStream();
    return newStream;
}

[C++] 
public:
   Stream* ChainStream( Stream* stream ){
      oldStream = stream;
      newStream = new MemoryStream();
      return newStream;
   }

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

SoapExtension Class | SoapExtension Members | System.Web.Services.Protocols Namespace

Show:
© 2015 Microsoft