How to intercept raw soap request/response (data) from WCF client
You don't have a specific tab that shows just the SOAP message - but the XML tab does include the whole SOAP message - no??
What is missing for you from this snippet of XML here??
UPDATE: John, you're unfortunately not showing what your <system.serviceModel>/<diagnostics>
section looks like - mine used for this result looks like this:
<diagnostics> <messageLogging logMessagesAtTransportLevel="true" logMessagesAtServiceLevel="false" logMalformedMessages="true" logEntireMessage="true" maxSizeOfMessageToLog="65535000" maxMessagesToLog="500" /></diagnostics>
Do you have the same settings? Maybe you're missing logEntireMessage
or something else??
I recently encountered the same problem as in the update to the original question: the trace was showing that a message had been sent, but the message itself wasn't there. For me, the fix was to add a System.ServiceModel.MessageLogging source. Here's my system.diagnostics config section:
<system.diagnostics> <sources> <source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true" > <listeners> <add name="xml"/> </listeners> </source> <source name="System.ServiceModel.MessageLogging"> <listeners> <add name="xml"/> </listeners> </source> </sources> <sharedListeners> <add name="xml" type="System.Diagnostics.XmlWriterTraceListener" initializeData="C:\logfiles\Traces.svclog" /> </sharedListeners></system.diagnostics>
And my system.serviceModel / diagnostics section:
<diagnostics> <messageLogging logMessagesAtTransportLevel="true" logMessagesAtServiceLevel="true" logMalformedMessages="true" logEntireMessage="true" maxSizeOfMessageToLog="65535000" maxMessagesToLog="500" /></diagnostics>
Once I added the MessageLogging source, the TraceViewer showed "Message Log Trace" traces which contained the actual SOAP messages.
There is an another way to see XML SOAP - custom MessageEncoder. The main difference from IDispatchMessageInspector / IClientMessageInspector is that it works on lower level, so it captures original byte content including any malformed xml.
In order to implement tracing using this approach you need to wrap a standard textMessageEncoding with custom message encoder as new binding element and apply that custom binding to endpoint in your config.
Also you can see as example how I did it in my project -wrapping textMessageEncoding, logging encoder, custom binding element and config.