WebServiceMethod类
//加密方式 ...... //查询 public HttpWebResponse PostRequest(string strRequestParams) { //建立HttpWebRequest HttpWebRequest req = (HttpWebRequest)WebRequest.Create(this.WebRequestURL); //定义网关 if (Proxy != "") { WebProxy objProxy = new WebProxy(this.Proxy); req.Proxy = objProxy; } req.Accept = "application/xml"; req.ContentType = "application/x-www-form-urlencoded;charset=UTF-8"; req.KeepAlive = false; req.Method = "POST"; if (req.Method == "POST") { byte[] b = System.Text.Encoding.GetEncoding("UTF-8").GetBytes(strRequestParams); req.ContentLength = b.Length; try { Stream oSRe = req.GetRequestStream(); //添加接口参数到流 oSRe.Write(b, 0, b.Length); oSRe.Close(); oSRe = null; } catch (Exception) { req = null; return null; } } HttpWebResponse myResponse = (HttpWebResponse)req.GetResponse(); return myResponse; }