How to look at the actual SOAP request/response in C#

前端 未结 4 1255
无人及你
无人及你 2020-12-20 16:28

I have added a wsdl file in my project as a service reference. The application sends SOAP messages to a particular device which then sends the response in SOAP format.

相关标签:
4条回答
  • 2020-12-20 17:02

    You can use the SVCTraceViewer to trace what are the messages that are being sent to and fro for each service call. You just have to set up the config and WCF builds the log files with the .svclog extension.

    More details on this tool and its associated configuration is here. This does not require any 3rd party tool or network inspectors to be run etc... This is out of the box from Microsoft.

    0 讨论(0)
  • 2020-12-20 17:14

    You are probably looking for SOAP extension, look at this post:

    Get SOAP Message before sending it to the WebService in .NET

    0 讨论(0)
  • 2020-12-20 17:17

    In case of WCF it has a less-known way to intercept original XML - custom MessageEncoder. It works on low level, so it captures real byte content including any malformed xml.

    If you want use this approach you need to wrap a standard textMessageEncoding with custom message encoder as new binding element and apply that custom binding to endpoint in your config.

    Also there is an example how I did it in my project - wrapping textMessageEncoding, logging encoder, custom binding element and config.

    0 讨论(0)
  • 2020-12-20 17:18

    Use Fiddler to inspect the messages. Ref: Using fiddler.

    0 讨论(0)
提交回复
热议问题