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

I overrided GetWebRequest() method in SoapHttpClientProtocol class in order to read and modify XML data that the RequestStream contains.

The problem is, the request seems to be empty, there is no data in it whatsoever. Is this because the SOAP data hasn't yet been generated and serialized or am I doing something wrong?

有帮助吗?

解决方案

What you need is a SoapExtension. You could hook into the SoapMessageStage.AfterSerialize stage in ProcessMessage to modify your soap message. I've done this in the past to add WSSE headers in situations where I couldn't add a dependency on Microsoft's WSE library (since it isn't available for Mono).

Complete tutorial here: http://msdn.microsoft.com/en-us/magazine/cc164007.aspx

GetWebRequest is too early for your purpose, GetWebResponse is too late.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top