C# HttpWebRequest 调用Web Service (Post)
HttpWebRequest myRequest = WebRequest.Create(url) as HttpWebRequest; myRequest.Method = "POST"; myRequest.ContentType = "application/x-www-form-urlencoded"; string requestParam = "abc=" + requestMsg; byte[] param = System.Text.Encoding.UTF8.GetBytes(requestParam); myRequest.ContentLength = param.Length; Stream myRequestStream = myRequest.GetRequestStream(); myRequestStream.Write(param, 0, param.Length); myRequestStream.Close(); HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse() as HttpWebResponse; ; Stream myResponseStream = myResponse.GetResponseStream(); StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.GetEncoding("utf-8")); responseMsg = myStreamReader.ReadToEnd(); myStreamReader.Close(); myResponseStream.Close();