Beispiel #1
0
        /// <summary>
        /// 创建网银客户端
        /// </summary>
        /// <returns></returns>
        private ICBC_NetSafeClient CreateOneNC()
        {
            ICBC_NetSafeClient client1 = new ICBC_NetSafeClient();

            client1.SetHttpsIP(ConfigurationManager.AppSettings["nc_ip"]);
            client1.SetSignIP(ConfigurationManager.AppSettings["nc_ip"]);
            client1.SetHttpsPort(Convert.ToInt32(ConfigurationManager.AppSettings["nc_hp"]));
            client1.SetSignPort(Convert.ToInt32(ConfigurationManager.AppSettings["nc_sp"]));
            client1.SetInterfaceVersion("0.0.0.1");
            client1.SetGroupID(ConfigurationManager.AppSettings["cis"]);
            client1.SetCertID(ConfigurationManager.AppSettings["id"]);

            //应该从配置文件里面获取,这里不设置
            string path  = Path.Combine(HttpRuntime.AppDomainAppPath, @"ICBC_Log\" + DateTime.Now.ToString("yyyyMMdd"));
            bool   flag1 = ConfigurationManager.AppSettings["log"].Trim().ToLower() == "on";

            if (flag1 && !Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            if (flag1 && Directory.Exists(path))
            {
                client1.SetLogFilePath(path);
                client1.SetLogSwitch(true);
            }

            client1.SetHttpsTimeOut(30);
            client1.SetSignTimeOut(10);
            return(client1);
        }
Beispiel #2
0
        /// <summary>
        /// 封装发送xml请求方法
        /// </summary>
        /// <param name="xml_str"></param>
        /// <param name="ver"></param>
        /// <returns></returns>
        private string ICBC_YQHL(string xml_str, string ver = "0.0.0.1")
        {
            XML_EASY xml_easy1 = new XML_EASY(xml_str);
            string   xMLNode   = xml_easy1.GetXMLNode("CIS", 0);
            string   str3      = xml_easy1.GetXMLNode("ID", 0);

            if (((xMLNode != ConfigurationManager.AppSettings["cis"]) || (str3 != ConfigurationManager.AppSettings["id"])) || (ver.Length == 0))
            {
                return("ReqID=|ReqResult=XML中CIS、ID与设定不符,或版本号信息有误!");
            }
            ICBC_NetSafeClient client = this.CreateOneNC();

            if (string.IsNullOrWhiteSpace(ver))
            {
                ver = "0.0.0.1";
            }
            client.SetInterfaceVersion(ver);

            //string path = Path.Combine(HttpRuntime.AppDomainAppPath, @"ICBC_Log\" + DateTime.Now.ToString("yyyyMMdd"));
            //bool flag1 = ConfigurationManager.AppSettings["log"].Trim().ToLower() == "on";
            //if (flag1 && !Directory.Exists(path))
            //{
            //    Directory.CreateDirectory(path);
            //}
            //if (flag1 && Directory.Exists(path))
            //{
            //    client.SetLogFilePath(path);
            //    client.SetLogSwitch(true);
            //}

            string seqNo, result;

            client.Run(xml_str, out seqNo, out result);
            client = null;

            //return ("ReqID=" + seqNo + "|ReqResult=" + Convert.ToBase64String(Encoding.GetEncoding("GBK").GetBytes(result)));
            return(result);
        }