View un-encrypted SOAP xml when calling CRM2011 WCF end point

If you've ever used an HTTP Proxy (like Fiddler) to debug web service calls to ASMX endpoints, you'll probably try the same with the CRM2011 WCF web services only to be greeted with an encrypted soap packet. If you want to see the plain soap xml calls your client application or web application is making you can use WCF logging.

1) Add the following to the configuration section of your web.config or app.config:


      <trace autoflush="true" />



        <source name ="System.ServiceModel.MessageLogging"
              switchValue="Verbose, ActivityTracing">
            <listeners>
                <add name="xml" />
            </listeners>
        </source>




      <add name="xml" type="System.Diagnostics.XmlWriterTraceListener"
           traceOutputOptions="LogicalOperationStack"
           initializeData="C:\CrmLogFile.svclog" />



<system.serviceModel>
        <diagnostics>
            <messageLogging
                 logEntireMessage="true"
                 logMalformedMessages="false"
                 logMessagesAtServiceLevel="true"
                 logMessagesAtTransportLevel="false"/>
        </diagnostics>
</system.serviceModel>

 

2) Now make your call and look for the Log File generated (defined via the initializeData attribute).

3) If you've got Visual Studio installed, you should be able to double click on the file and open the Microsoft Service Trace Viewer and examine the un-encrypted soap messages – both sent and received.

See http://msdn.microsoft.com/en-us/library/aa702726.aspx for more information.

Comments are closed