How to get raw data from the web service request?

advertisements

I want to check raw data string (raw xml) received by my web service methods (for logging and debugging purposes).

I saw recommendations: to handle 'BeginRequest' event in HttpApplication. But I don't see which field of 'Request' object contains this POST data?


Related question: Getting RAW Soap Data from a Web Reference Client running in ASP.net

- Have you seen this answer using tracing? or this one using a SoapExtension

I made following changes in web.cofig to get SOAP(Request/Response) Envelope. It makes trace.log file where all the required information are present

<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>