Set SOAPAction manually

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".
From the debugger I see that the previous value of the headers is the
UserAgent. After my setting, the headers include "Prueba: Prueba1" (or
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top