How do I get the XML SOAP request of an WCF Web service request?

后端 未结 7 638
太阳男子
太阳男子 2020-12-07 08:28

I\'m calling this web service within code and I would like to see the XML, but I can\'t find a property that exposes it.

7条回答
  •  北海茫月
    2020-12-07 09:09

    There is an another way to see XML SOAP - custom MessageEncoder. The main difference from 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.

提交回复
热议问题