views:

36

answers:

2

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?

+1  A: 

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>
SDReyes
What is not set to verbose? : O
SDReyes
You changed it now!
Aliostad
Ohh gosh... you saw an asnwer with broken xml, didn't you? :P I made a bad quote the first time, but you can seek the link to see the full posts :)
SDReyes
Sorry, I didn't find listed topics, thank you for help. Unfortunately, suggested approach didn't log anything... don't know why... Have found article on MSDN, will try to figure out...
Budda
Probably, I do need to do Trace.Write... ? But how can I access the row data in this case?
Budda
In debug mode, when VisualStudio is attached to project - I saw a verbose debug information (everything what is required) in 'Debug Output' window... but this data is not saved into specified log-file... don't know why.... If you have any ideas, please let me know! Thank you in advance
Budda
Issue was in access permissions to the log folder. Thank for the help
Budda
+1  A: 

It would not make sense to keep all the request post data in the request object since it could contain uploaded file and be very big.

I have two solutions for you:

1) Use Fiddler on the server and browse locally the website (using server name and not localhost since Fiddler cannot show localhost request/responses)

2) Use System.Net tracing: http://support.microsoft.com/kb/947285

You can also use WireShark to look at the packets but this will not keep the request response context.

Aliostad
System.Net tracing is just perfect!
Budda