How to intercept raw soap request/response (data) from WCF client

Posted by JohnIdol on Stack Overflow See other posts from Stack Overflow or by JohnIdol
Published on 2010-05-10T12:34:32Z Indexed on 2010/05/10 13:24 UTC
Read the original article Hit count: 1261

Filed under:
|
|

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>

© Stack Overflow or respective owner

Related posts about wcf

Related posts about ASP.NET