With the Web Service Enhancement (WSE) Toolkit it is very easy to view incoming/outgoing SOAP requests - just check the “Enable Message Trace“ option in the option in the Diagnostics tab of the WSE Toolkit, and off you go. But prior to the WSE Toolkit, providing such essential debugging information was, unfortunately, not as straightforward or easy. Older books on Web services, for example, talk about using the SOAP Toolkit, from which you can create a SOAP proxy to record the incoming and outgoing SOAP messages. However, there's a much easier way, as Web service-guru Michele Leroux-Bustamante showed me 14 months ago, almost to the day: in a Web service method, add th following code to save the incoming SOAP content:
HttpContext.Current.Request.SaveAs(filePathToSaveSOAPData, true);
This will dump the incoming request to a file, including the headers (set the second parameter to False to omit the headers). Unfortunately this raw text output is not nicely indented like the WSE Toolkit output, but it provides a simple way to quickly inspect the incoming SOAP requests from the Web service.
Speaking of Michele, she'll be speaking at the ASP.NET Connections conference, which starts up with pre-session tracks tomorrow and continues throughout all next week. I mention this because I'll be there, too. Well, not inside the conference, per se, but in Vegas, at the Mandalay Bay resort. My wife's company is sending her, so I decided to tote along as a bit of a vacation (for myself). So, while my wife's toiling away in the conference sessions, learning the latest and greatest information about ASP.NET 1.x and 2.0, I'll be hitting the blackjack tables! (More accurately I'll likely be holed up in the hotel room, working on my two upcoming MSDN articles, but I promise to at least periodically fantasize about striking it rich with lady luck.)