62,046
社区成员
发帖
与我相关
我的任务
分享
string data = string.Format(@"
<?xml version=""1.0"" encoding=""utf-8""?>
<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">
<soap:Body>
<HelloWorld xmlns=""http://tempuri.org/"">
<abc>
<a>纳菲恩</a>
<b>123</b>
<c>
<string>gg</string>
<string>ff</string>
<string>火锅</string>
<string>办法</string>
</c>
</abc>
</HelloWorld>
</soap:Body>
</soap:Envelope>");
HttpWebRequest wrt = (HttpWebRequest)WebRequest.Create("http://localhost:9542/MyServices.asmx");
wrt.Headers.Add("Accept-Encoding", "gzip,deflate,sdch");
wrt.Headers.Add("Accept-Language", "zh-CN,zh;q=0.8");
wrt.Headers.Add("Cache-Control", "max-age=0");
wrt.Headers.Add("SOAPAction", "http://tempuri.org/HelloWorld");
wrt.ContentType = "text/xml; charset=utf-8";
wrt.Method = "POST";
wrt.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22";
wrt.Referer = "http://localhost:9542/MyServices.asmx?op=HelloWorld";
wrt.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
wrt.Connection = "Open";
byte[] byteArray = Encoding.UTF8.GetBytes(data);
wrt.ContentLength = byteArray.Length;
Stream stream = wrt.GetRequestStream();
stream.Write(byteArray, 0, byteArray.Length);
stream.Close();
string html = ReadZipData(wrt);