Note that there are some explanatory texts on larger screens.

plurals
  1. POC# extending SoapExtension -
    primarykey
    data
    text
    <p><strong>Background:</strong> I'm trying to write a simple SoapExtension class to log inbound/outbound Soap messages from an asmx web service. Following <a href="http://msdn.microsoft.com/en-us/library/system.web.services.protocols.soapextension%28VS.85%29.aspx">this article on msdn</a>, I have been able to get things working. However I'd really like to understand why/how it's working rather than just copy &amp; pasting code.</p> <p><strong>The question:</strong> What I'm stuggling to grasp specifically is the handling of the IO streams in the example. All other articles I've read on the web handle the streams in an identical way... first getting a reference to the original stream, creating an in memory "working" stream, and then swapping the contents as necessary.</p> <p>First question is, what is meant by "stream chaining" in this context? My understaning of streams is that writing to any stream will automatically write to the 'inner' streams in a pipeline. If that's the case, why is it necessary to manually copy contents from one stream to another?</p> <p>Second question is, in the examples Copy method they're creating a StreamReader and StreamWriter each time, without disposing them - is this not putting extra pressure on the GC? Doesn't seem like something you'd want on a high traffic web service... I tried wrapping both in using statements, but disposing the reader/writer also closed the stream which led to more serious errors. .NET 4 has new Stream.CopyTo(Stream) methods, but what would be a better approach for .NET 3.5?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload