string postData = "<TemplateInfo xmlns:i='http://www.w3.org/2001/XMLSchema-instance'>" + "<UserID>254</UserID>" + "</TemplateInfo>";
byte[] byteArray = Encoding.UTF8.GetBytes(postData);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://172.19.18.126/TAExcelApps/TemplateService/GetTemplatesInfos");
request.ContentLength = byteArray.Length;
request.ContentType = "application/xml";
request.Method = "POST";
using (Stream dataStream = request.GetRequestStream())
{
dataStream.Write(byteArray, 0, byteArray.Length);
}
using (HttpWebResponse httpResponse = request.GetResponse() as HttpWebResponse)
{
Stream ResponseStream = null;
ResponseStream = httpResponse.GetResponseStream();
int responseCode = (int)httpResponse.StatusCode;
string responseBody = ((new StreamReader(ResponseStream)).ReadToEnd());
Console.WriteLine(responseBody.ToString());
}
Console.ReadLine();