SoapExtension.ChainStream Method

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

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

public:
virtual Stream^ ChainStream (
	Stream^ stream
)
public Stream ChainStream (
	Stream stream
)
public function ChainStream (
	stream : Stream
) : Stream
Not applicable.

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.

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 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 BeforeDeserializeSoapMessageStage. Similarily, the Stream reference returned from ChainStream is written into when the serialization occurs and thus contains the serialized SOAP response in the AfterSerializeSoapMessageStage.

The following example saves both the Stream passed into ChainStream and the Stream returned from ChainStream in the member variables oldStream and newStream, respectively.

public:
   virtual Stream^ ChainStream( Stream^ stream ) override
   {
      oldStream = stream;
      newStream = gcnew MemoryStream;
      return newStream;
   }

public Stream ChainStream(Stream stream)
{
    oldStream = stream;
    newStream = new MemoryStream();
    return newStream;
} //ChainStream

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

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

ADD
Show: