| | |
| | | using System.IO; |
| | | using System.Linq; |
| | | using System.Net; |
| | | using System.Net.Security; |
| | | using System.Reflection; |
| | | using System.Security.Cryptography.X509Certificates; |
| | | using System.Text; |
| | | using System.Xml; |
| | | using Newtonsoft.Json; |
| | |
| | | { |
| | | public class HttpHelper |
| | | { |
| | | private static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) |
| | | { |
| | | return true; //如果不希望验证证书有效性,直接返回 true |
| | | } |
| | | |
| | | private static HttpWebRequest GetHttpWebRequest(string url, Dictionary<string, string> headerDic, string method) |
| | | { |
| | | HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest; |
| | |
| | | } |
| | | try |
| | | { |
| | | if (url.Contains("https")) |
| | | { |
| | | ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult); |
| | | } |
| | | var requestData = GetResponseString(request); |
| | | LogFile.SaveLogToFile($"{logStr}反馈:( {requestData} ),", logStr2); |
| | | return requestData; |
| | |
| | | //修改参数的值 |
| | | foreach (var de in Pars) |
| | | { |
| | | string subNode = "DataList/Product/Batch";// + de.Key.ToString(); |
| | | string subNode = "DataList/Events/Event/Relation/Batch";// + de.Key.ToString(); |
| | | |
| | | XmlNode node = xml.SelectSingleNode(subNode, nsmgr); |
| | | if (de != null) |
| | | { |
| | | XmlNode createNode = xml.CreateNode(XmlNodeType.Element, "Data", ""); |
| | | XmlAttribute attr = xml.CreateAttribute("code"); |
| | | attr.Value = de; |
| | | XmlAttribute attr = xml.CreateAttribute("Code"); //箱码 |
| | | attr.Value = de.Split(",")[0]; |
| | | createNode.Attributes.Append(attr); |
| | | attr = xml.CreateAttribute("CorpOrderID"); //单据号 |
| | | attr.Value = de.Split(",")[1]; |
| | | createNode.Attributes.Append(attr); |
| | | attr = xml.CreateAttribute("Actor"); //操作人 |
| | | attr.Value = de.Split(",")[2]; |
| | | createNode.Attributes.Append(attr); |
| | | attr = xml.CreateAttribute("ActDate"); //操作时间 |
| | | attr.Value = de.Split(",")[3]; |
| | | createNode.Attributes.Append(attr); |
| | | attr = xml.CreateAttribute("DisCorpID"); //运输企业 |
| | | attr.Value = ""; |
| | | createNode.Attributes.Append(attr); |
| | | attr = xml.CreateAttribute("AssCorpID"); //委托企业 |
| | | attr.Value = ""; |
| | | createNode.Attributes.Append(attr); |
| | | attr = xml.CreateAttribute("ToCorpID"); // 下游收货企业编号 |
| | | attr.Value = ""; |
| | | createNode.Attributes.Append(attr); |
| | | attr = xml.CreateAttribute("FromPerson");//发货人 |
| | | attr.Value = ""; //de.Split(",")[2] |
| | | createNode.Attributes.Append(attr); |
| | | node.AppendChild(createNode); |
| | | } |
| | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |