Friday, February 20, 2009

View the raw SOAP messages (only) in ILM 2 trace log

Have you come across the advice to "turn on tracing" in ILM 2 to view the raw SOAP messages? Earlier this week, I spent a whole day trying to figure out the best way to do this, and it turns out it's REALLY SIMPLE. But first, some background. :)

I said to myself, "Self, this should be possible with a network sniffer, right?" I downloaded Netmon; wow, that was ugly, and I never even found the SOAP messages. Then I tried Ethereal/Wireshark; no luck. EffeTech HTTP sniffer; nada. I was about to try TcpMon and/or SOAP Trace Utility, when I had a revelation. This stuff's built on Windows Communication Foundation; shouldn't there be a utility to trace this sophisticated API? Finally, this was the right question to ask.

Turns out the message tracing is built into WCF. And while you may have enabled tracing in your ILM 2 web service, there's actually a way to enable tracing on only the SOAP messages. Nice, huh? Here's a link to the MSDN article on how to turn on message logging, but I'll go through the exact steps for you to try to save you some time.

Before I begin, I should mention that Andreas Kjellman posted an answer to a question on the Connect site on how to enable tracing, but his directions weren't exclusive to the SOAP messages.

  1. Begin by locating your web service config file. Mine is at C:\Program Files\Microsoft Identity Management\Common Services\Microsoft.ResourceManagement.Service.exe.config. Edit the file and add the following bold sections.


    <!-- Begin Message Logging/Tracing -->
    <trace autoflush="true" />
    <source name="System.ServiceModel.MessageLogging">
    initializeData="c:\logs\Messages.svclog" />
    <!-- End Message Logging/Tracing -->



    <!-- Begin Message Logging/Tracing Settings -->
    <!-- End Message Logging/Tracing Settings -->





  2. As Andreas points out in his instructions, make sure the service host account has write permissions to the C:\logs folder.

  3. Save the file and restart the Microsoft Identity Lifecycle Manager Service (IdentityManagementService).

    The log file can grow pretty quickly, so you may want to isolate the logging to only a few requests. To stop logging, simply comment the listener (shown here) and restart the service.

    <!--<add name="messages"
    initializeData="c:\logs\Messages.svclog" />

  4. The .svclog file will open in the Service Trace Viewer (SvcTraceViewer.exe), which is installed with the Windows SDK for Windows Server 2008 and .NET Framework 3.5. Just try double-clicking the file first, if you're not sure you have it installed. You might also find it at C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin\SvcTraceViewer.exe (or similar).

  5. In the Service Trace Viewer, click on the activity in the left pane and click on a message log trace. In the bottom pane, you'll see the details of the SOAP message. Click on the XML tab in the bottom pane and you'll find the SOAP envelope in its entirety inside the trace XML (SOAP envelope begins with "s:Envelope").

I hope this helps you. Best of luck!


  1. Awesome work -- I was wondering how you get the actually messages! Wish I had known how to trace the actual messages months ago!

  2. Awesome dude...fantastic..I exactly want to see the same and got it..Thanks a ton...