日期:2014-05-17 浏览次数:20851 次
string reponse
byte[] data = this.encoder.GetBytes(request);
HttpWebRequest http = WebRequest.Create(url) as HttpWebRequest;
http.Timeout = 2000;
http.ContentType = "application/soap+xml; charset=utf-8";
http.ContentLength = data.Length;
http.Method = "POST";
using (Stream writer = http.GetRequestStream()) {
writer.Write(data, 0, data.Length);
}
using (WebResponse resp = http.GetResponse()) {
using (StreamReader reader = new StreamReader(resp.GetResponseStream(), this.encoder, false, (int)resp.ContentLength)) {
response = reader.ReadToEnd();
}
}