Reputation: 50067
This question seems to be pretty close to what I am looking for - I was able to setup tracing and I am looking at the log entries for my calls to the service.
However I need to see the raw soap request with the data I am sending to the service and I see no way of doing that from the SvcTraceViewer (only log entries are shown but no data sent to the service) - am I just missing configuration?
Here's what I got in my web.config:
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Verbose"
propagateActivity="true">
<listeners>
<add name="sdt"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="App_Data/Logs/WCFTrace.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
Any help appreciated!
UPDATE: this is all I see in my trace:
<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
<EventID>262163</EventID>
<Type>3</Type>
<SubType Name="Information">0</SubType>
<Level>8</Level>
<TimeCreated SystemTime="2010-05-10T13:10:46.6713553Z" />
<Source Name="System.ServiceModel" />
<Correlation ActivityID="{00000000-0000-0000-1501-0080000000f6}" />
<Execution ProcessName="w3wp" ProcessID="3492" ThreadID="23" />
<Channel />
<Computer>MY_COMPUTER_NAME</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Information">
<TraceIdentifier>http://msdn.microsoft.com/en-US/library/System.ServiceModel.Channels.MessageSent.aspx</TraceIdentifier>
<Description>Sent a message over a channel.</Description>
<AppDomain>MY_DOMAIN</AppDomain>
<Source>System.ServiceModel.Channels.HttpOutput+WebRequestHttpOutput/50416815</Source>
<ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/MessageTraceRecord">
<MessageProperties>
<Encoder>text/xml; charset=utf-8</Encoder>
<AllowOutputBatching>False</AllowOutputBatching>
<Via>http://xxx.xx.xxx.xxx:9080/MyWebService/myService</Via>
</MessageProperties>
<MessageHeaders></MessageHeaders>
</ExtendedData>
</TraceRecord>
</DataItem>
</TraceData>
</ApplicationData>
Upvotes: 10
Views: 16612
Reputation: 754220
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??
Upvotes: 12
Reputation: 2115
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.
Upvotes: 0
Reputation: 2950
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.
Upvotes: 12