«

A Tracing Soap Extension

In honor of the new GotDotNet RSS Feeds, I decided to post a little sample TraceLoggerSoapExtension I wrote to help myself out.


Here’s a snip from the included readme file:


The TraceLoggerSoapExtension is a modification of the MSDN sample SoapExtension. Instead of logging the incoming and outgoing messages to a file, the messages are written to either the System.Web trace log, or whatever TraceListener objects are registered (depending on your configuration choices).Web.Config or App.Config example usage:

       <webServices>      <soapExtensionTypes>       <add type="GLindsay.Web.Services.SoapExtensions.TraceLoggerSoapExtension,GLindsay.Web.Services.SoapExtensions"            priority="1"            group="0" />      </soapExtensionTypes>     </webServices>

Server Declaritive usage:

[GLindsay.Web.Services.SoapExtensions.TraceLoggerSoapExtension(GLindsay.Web.Services.SoapExtensions.TraceType.WebTrace)]

When using the declaritive syntax, it’s possible to specify “TraceType.WebTrace” for System.Web tracing, or “TraceType.DiagnosticsTrace” to use the System.Diagnostics TraceListeners. While in client context, the SoapExtension automatically switches to TraceType.DiagnosticsTrace. That means you’ll see the
logged messages in VS.NET’s output window.

Don’t forget to send me mail if you find this useful!


I only wish the GotDotNet site exposed RSS feeds for individual user downloads. I’d love to be able to track the number of downloads for my samples from my hand dandy news aggregator.