tags:

views:

17

answers:

1

I have a WCF client for which I need to log messages. I need the complete SOAP envelope of both requests and replies.

My app.config file has logging set up thusly:

<diagnostics>
  <messageLogging logMalformedMessages="false" logMessagesAtServiceLevel="true"
                  logMessagesAtTransportLevel="false" logEntireMessage="true" 
                  maxMessagesToLog="100" maxSizeOfMessageToLog="20000000" />
</diagnostics>

The message log is populated correctly... almost! For the requests only, the SOAP body is elided like this:

<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Id="signature_e">...</s:Body>

Does anyone have any idea now to get the full SOAP body into my log?

+1  A: 

It turns out that one of the behaviors I had configured for this endpoint (an IClientMessageInspector) was creating a subclass of Message, and that this subclass didn't override OnBodyToString() which is used for logging. The default implementation of OnBodyToString() just prints out ... an ellipsis!

The Message class is a tricky beast indeed.

Paul Lalonde