Last active
January 13, 2016 15:09
-
-
Save belchev/04580878904cadd984f7 to your computer and use it in GitHub Desktop.
WCF send custom header request - dirty way
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string url = "http://url.com/*.wsdl"; | |
using (var client = new WebClient()) | |
{ | |
var data = System.IO.File.ReadAllText(HostingEnvironment.MapPath(@"~/App_Data/request.xml")); | |
client.Headers.Add("Content-Type", "text/xml;charset=utf-8"); | |
client.Encoding = Encoding.GetEncoding("ISO-8859-1"); | |
client.Credentials = new NetworkCredential("username", "pass"); | |
client.Headers.Add("SOAPAction", "\"http://url.com/wsdl?action\""); | |
var response = client.UploadString("http://url.com/wsdl", data); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment