Monday, February 15, 2010

Down and dirty with Trace Listerners for SOAP Messages

2 comments:
Recently I was trying to implement a web service call for a client who had another firm implementing a very secure web service using client certificates (Ill blog about how to get that working sometime soon). However once Id got the security sorted I was getting a Method not allowed 403 error in order to diagnose the problem I needed ot get at the raw data travelling across the wire. as it happens dot net has a brilliant diagnostics suite which is really simple to implement. Simply add the following into your web.config file underneath the system.web node and presto youll get a trace.log file will all that lovely low level info in!

Original Article here on StackOverflow; http://stackoverflow.com/questions/300674/getting-raw-soap-data-from-a-web-reference-client-running-in-aspnet


<system.diagnostics>

    <trace autoflush="true"/>
    <sources>
      <source name="System.Net" maxdatasize="1024">
        <listeners>
          <add name="TraceFile"/>
        </listeners>
      </source>
      <source name="System.Net.Sockets" maxdatasize="1024">
        <listeners>
          <add name="TraceFile"/>
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add name="TraceFile" type="System.Diagnostics.TextWriterTraceListener" initializeData="trace.log"/>
    </sharedListeners>
    <switches>
      <add name="System.Net" value="Verbose"/>
      <add name="System.Net.Sockets" value="Verbose"/>
    </switches>
  </system.diagnostics>
Read More