'Adding Headers to Soap Request .Net

I added a web service reference to my existing visual studio project, I not able to execute any of the service methods as i keep getting "missing headers" error.

Then newly generated proxy class doesn't have method to add headers. Is there a way i can add http header to the request



Solution 1:[1]

Override the method GetWebRequest in the proxy class Then add below code

 HttpWebRequest request = base.GetWebRequest();
 request.Headers.Add("HeaderName", "HeaderValue");
 return request

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Rakesh