6
6kjfsyg02
I am trying to manipulate a web service call so that the content of
the SOAPAction header is read from a configuration file.
I am overriding the GetWebRequest method of the generated proxy:
protected override WebRequest GetWebRequest(Uri uri)
{
HttpWebRequest req = ( System.Net.HttpWebRequest)
base.GetWebRequest(uri);
req.Headers["Prueba"] = "Prueba1";
return req;
}
In the sample code, you see I am inserting a "Prueba" header just for
testing. I have of course tried with "SOAPAction".
the SOAPAction value I set).
However when I debug the call from a SOAPExtension I see that there
are no values in SoapClientMessage.Headers collection. Not even the
UserAgent! SoapClientMessage action has the value from the
SoapDocumentMethod attribute of the Web method, not the one I am
trying to set.
This is so in the BeforeSerialize and the AfterSerialize stages.
SoapVersion is Soap11.
So what is the proper way to intercept and change the value of the
SOAPAction HTTP header?
Thanks in advance.
the SOAPAction header is read from a configuration file.
I am overriding the GetWebRequest method of the generated proxy:
protected override WebRequest GetWebRequest(Uri uri)
{
HttpWebRequest req = ( System.Net.HttpWebRequest)
base.GetWebRequest(uri);
req.Headers["Prueba"] = "Prueba1";
return req;
}
In the sample code, you see I am inserting a "Prueba" header just for
testing. I have of course tried with "SOAPAction".
UserAgent. After my setting, the headers include "Prueba: Prueba1" (orFrom the debugger I see that the previous value of the headers is the
the SOAPAction value I set).
However when I debug the call from a SOAPExtension I see that there
are no values in SoapClientMessage.Headers collection. Not even the
UserAgent! SoapClientMessage action has the value from the
SoapDocumentMethod attribute of the Web method, not the one I am
trying to set.
This is so in the BeforeSerialize and the AfterSerialize stages.
SoapVersion is Soap11.
So what is the proper way to intercept and change the value of the
SOAPAction HTTP header?
Thanks in advance.