The HttpWebRequest has a Headers collection, to which you can add custom headers. Note that you can't set some the headers which are exposed as specific properties of the Request object, like UserAgent, ContentLength and so on.
You don't need to set most of those headers. Host and contentlength are set automatically. Authentication is done using the HttpWebRequest.Credentials member. UserAgent is fairly inconsequential (although I've seen web sites that didn't work if it wasn't
sent at all).
So what you actually need to set is the soapaction, and for that you can use the Headers collection.
A question though: why are you not using the built-in Web Services functionality of .Net?
I'm not using the built in functionality in .net b/c the service is hidden. I can't reference the service b/c the service cannot be discovered. We have purchased a product from Cognos that is kind of buggy. Our drill thru reports fail on occasion until
we open and resave the report. This resave action is this soap request I'm working on, but they want me to do it manually, using a web browser that uses ActiveX controls to submit this soap request. So, I've used fiddler to discover the soap request so that
I can submit it automatically. The Object explorer does not say you can set the headers, it only says you can get them (but this is at the HttpWebRequest level). At the WebRequest level, you can both get and set them. I didn't see this at first.
Since this post doesn't belong here, is it possible to delete it all together. I will not post this type of post to this forum again.
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.