Tracing the SOAP envelope that is being sent by a .NET web service client possible?

If you're using a standard web service (not WFC), you can extend the SoapExtension class as described here:

http://www.blog.encoresystems.net/articles/how-to-capture-soap-envelopes-when-consuming-a-web-service.aspx

If you're using WFC, then you can implement IEndpointBehavior and IClientMessageBehavior as described here:

http://weblogs.asp.net/paolopia/archive/2007/08/23/writing-a-wcf-message-inspector.aspx

I use both, depending on whether I'm using web or service references.


You can use fiddler, perhaps, as a proxy and thus monitor HTTP/HTTPS requests. This won't require you to write any code on your part.

Fiddler Web Debugger

It is worth noting that there are caveats to debugging HTTPS requests with Fiddler. This page explains how it can be done.

Fiddler Web Debugger - Debugging HTTPS traffic with Fiddler2


You can use Fiddler, or System.Net tracing.

http://blogs.msdn.com/dgorti/archive/2005/09/18/471003.aspx http://msdn.microsoft.com/en-us/library/bb203855(BTS.10).aspx