Capturing SOAP requests to an ASP.NET ASMX web service

前端 未结 4 1644
伪装坚强ぢ
伪装坚强ぢ 2020-11-28 07:03

Consider the requirement to log incoming SOAP requests to an ASP.NET ASMX web service. The task is to capture the raw XML being sent to the web service.

The incomin

4条回答
  •  猫巷女王i
    2020-11-28 07:08

    There are no easy ways to do this. You will have to implement a SoapExtension. The example at the previous link shows an extension that can be used to log the data.

    If you had been using WCF, then you could simply set the configuration to produce message logs.


    According to Steven de Salas, you can use the Request.InputStream property within the webmethod. I have not tried this, but he says that it works.

    I would want to test this with both http and https, and with and without other SoapExtensions running at the same time. These are things that might affect what kind of stream the InputStream is set to. Some streams cannot seek, for instance, which might leave you with a stream positioned after the end of the data, and which you cannot move to the beginning.

提交回复
热议问题