Logging service SOAP request and response

后端 未结 2 485
旧巷少年郎
旧巷少年郎 2021-01-12 09:28

I am trying to log the soap request and response messages of a service in C#. I have a ready made soap extension which does all this, however I am having trouble adding it t

相关标签:
2条回答
  • 2021-01-12 10:03

    There is an another way to see XML SOAP - custom MessageEncoder. The main difference from IDispatchMessageInspector / IClientMessageInspector is that it works on lower level, so it captures original byte content including any malformed xml.

    In order to implement tracing using 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 you can see as example how I did it in my project - wrapping textMessageEncoding, logging encoder, custom binding element and config.

    0 讨论(0)
  • 2021-01-12 10:15

    Soap extension is only for using ASMX based service or client = Add web reference. Once you used Add service reference you are using WCF client API instead and you cannot use Soap extension. You must create message inspector instead.

    If you need message logging only for debugging purpose you can use built in WCF message logging.

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