.NET Log or View Call / Response for SOAP WebService

What is the best way to check web service calls and responses in .NET?
I interact with a web service written in Perl and run into problems.
How can I capture call and answer text?

UPDATE:
Based on comments, to clarify: I would like to do this through .NET so that I can register it or email it when a problem occurs.

+4
source share
4 answers

You can do this by creating SoapExtension and enabling it in your web service client:

System.Web.Services.Protocols.SoapExtension Class (MSDN)

The link above contains the skeleton of a sample code that logs requests / responses to a file.

To enable in your application, add the following to your web.config or app.config:

 <webServices> <soapExtensionTypes> <add type="YourNamespace.TraceExtension, AssemblyName" priority="0" group="High"/> </soapExtensionTypes> </webServices> 

My own SOAP trace extension is implemented in my own project / assembly. Whenever I need to debug a request / response, I just drop the DLL into the application folder (/ bin for ASP.NET) and add the link to the configuration file as described above.

For instance:

 <webServices> <soapExtensionTypes> <add type="DebugTools.SOAP.SOAPTrace.SoapTraceExtension, DebugTools.SOAP" priority="0" group="High"/> </soapExtensionTypes> </webServices> 

DebugTools.SOAP.SOAPTrace is the SoapTraceExtension namespace
DebugTools.SOAP is the name of the assembly containing the soap trace code.

+10
source

Fiddler is your best friend in the world of web services.


No, it does not do anything inside the code as indicated. You also do not want to do this - debugging should not change the semantics of the process, or you are debugging your debugging code.

In addition, I am cordial to some wires, but the violinist is slightly better for HTTP materials, as it is designed to focus on HTTP. If I grab bytes from wires, it will be wirehark completely.

+4
source

Personally, I like to use packet sniffer like Wireshark . This is a great tool for checking any network traffic.

0
source

In the WCF web service or client, you can simply configure tracing and / or message logging. This can be done at runtime without changing the code.

0
source

Source: https://habr.com/ru/post/1286491/


All Articles