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

前端 未结 4 1275
无人及你
无人及你 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: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.

提交回复
热议问题