C# Web Services provide an easy interface to incoming SOAP data because the SOAP message has already been deserialised at the entry point of a WebMethod.
The downside is that sometimes you’ll need to have access to the full SOAP request: body, headers and everything for tasks such as diagnosing any errors (which message broke the web service) or providing graceful handling of third party web services.
At first you’d think that the Request object can provide this information with methods such as Request.BinaryRead() but unfortunately when you’re using SOAP all you get there is a querystring.
The solution here is to use the SOAP Extensions. Here is some sample code:
public class SoapMessageLogger : SoapExtension
public override void ProcessMessage(SoapMessage message)
// Do nothing on other states
I have a trivial issue with your article. There is no such thing as “C# Web Services”, any more than there are “VB.NET Web Services”. These are legacy ASMX web services (sometimes known as ASP.NET Web Services).
http://www.codeproject.com/cs/webservices/SerializationFun.asp not found
Using SoapExtension in Client ?
C# Web SErvices vs VB.NET Web Services ??