Debug SOAP request and response in WCF
Often while working with SOAP service integrations I would like to see the actual SOAP envelope that is passed around. This is not trivial while working with WCF, because it effectivly hide the implementation details. You'll will have to turn on WCF message debugging.
That is done in web.config.
<system.serviceModel> <diagnostics wmiProviderEnabled="true"> <messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" maxMessagesToLog="3000" /> </diagnostics> </system.serviceModel> </configuration>
When you run your code a file called Traces.svclog should be created in your output directory. In a website this would be root of the site, and in a native application, this would be the bin folder.
You can open it in Microsoft Service Trace Viewer or just an ordinary text editor.
I find this very useful when dealing with services from other companies, where as I can really say - I'm sending this SOAP request and I'm recieving this response. That's not expected, is it?