mikefourie-zz / MSBuildExtensionPack

MIT License
366 stars 104 forks source link

[enhancement] HttpWebRequest: allow to add HTTP headers (e.g. 'SOAPAction') #78

Open o7g8 opened 6 years ago

o7g8 commented 6 years ago

Hello,

I have a case where it would be handy to call a SOAP service from MSBuild using the HttpWebRequest task. Unfortunately the service expects the SOAPAction header (it's common for SOAP services to expect the header). Unfortunately it's not possible to supply additional HTTP headers in the current HttpWebRequest implementation.

In order to verify my assumption about the necessity of SOAPAction header, I have experimented with curl. I have found an absolute minimum of overridden HTTP headers, which are sufficient for getting a valid response from the SOAP service:

curl -X POST -H 'SOAPAction: "MyAction"' -H 'Content-Type: text/xml;charset=UTF-8' -d @soap_payload.xml http://myserver:myport/MyService/