Modifying SOAP Requests Using GetWebRequest

I am trying to dynamically change XML data in SOAP requests for ASMX services.

I overridden the GetWebRequest() method in the SoapHttpClientProtocol class to read and modify the XML data contained in the RequestStream .

The problem is that the request seems empty, there is no data in it. Is it because SOAP data has not yet been generated and serialized, or am I doing something wrong?

+4
source share
1 answer

You need SoapExtension . You can go to the SoapMessageStage.AfterSerialize step in ProcessMessage to change your soap message. I did this in the past to add WSSE headers in situations where I could not add a dependency on the Microsoft WSE library (since it is not available for Mono).

The full tutorial is here: http://msdn.microsoft.com/en-us/magazine/cc164007.aspx

GetWebRequest too early for your purpose; GetWebResponse too late.

+2
source

Source: https://habr.com/ru/post/1381303/


All Articles