From 0e0858d4bdfeb758c70acfb1269ab5826b4e89d6 Mon Sep 17 00:00:00 2001 From: wanli Date: Thu, 22 Dec 2022 10:13:53 +0800 Subject: [PATCH] =?UTF-8?q?[App]=20=E8=AE=80=E5=8F=96xml=E6=AA=94=E6=94=B9?= =?UTF-8?q?=E6=88=90=20=E8=AE=80=E5=8F=96=E7=B7=9A=E4=B8=8A=E7=9A=84N4?= =?UTF-8?q?=E8=B3=87=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- z01_WinAPP/Service/webRequestSvc.cs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/z01_WinAPP/Service/webRequestSvc.cs b/z01_WinAPP/Service/webRequestSvc.cs index cf8da19..1b27b2c 100644 --- a/z01_WinAPP/Service/webRequestSvc.cs +++ b/z01_WinAPP/Service/webRequestSvc.cs @@ -149,24 +149,24 @@ namespace tpDomeWinAPP.Service String encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(username + ":" + password)); String API_Url = urlString; - //HttpWebRequest Postrequest = (HttpWebRequest)WebRequest.Create(API_Url); - //Postrequest.Method = "POST"; - //Postrequest.Headers.Add("Authorization", "Basic " + encoded); - //Postrequest.PreAuthenticate = true; + HttpWebRequest Postrequest = (HttpWebRequest)WebRequest.Create(API_Url); + Postrequest.Method = "POST"; + Postrequest.Headers.Add("Authorization", "Basic " + encoded); + Postrequest.PreAuthenticate = true; - //using (var streamWriter = new StreamWriter(Postrequest.GetRequestStream())) - //{ - // string json = ""; + using (var streamWriter = new StreamWriter(Postrequest.GetRequestStream())) + { + string json = ""; - // streamWriter.Write(json); - //} + streamWriter.Write(json); + } - //HttpWebResponse response = (HttpWebResponse)Postrequest.GetResponse(); - //var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd(); + HttpWebResponse response = (HttpWebResponse)Postrequest.GetResponse(); + var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd(); XmlDocument xmlDoc = new XmlDocument(); - //xmlDoc.LoadXml(responseString); - xmlDoc.Load("N4v1021.xml");//N4v1021 + xmlDoc.LoadXml(responseString); + //xmlDoc.Load("N4v1021.xml");//N4v1021 //xmlDoc.Save("N4.xml");