Exemplo n.º 1
0
        /**
         * java main方法 数据提交 提交到后台
         *
         * @param contentData
         * @return 返回报文 map
         */
        public static Dictionary <string, string> SubmitUrl(Dictionary <string, string> submitFromData, string requestUrl)
        {
            string resultString = "";

            /**
             * 发送
             */
            HttpClient hc = new HttpClient(requestUrl);

            try
            {
                int status = hc.Send(submitFromData, Encoding.UTF8);
                if (200 == status)
                {
                    resultString = hc.Result;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            var resData = new Dictionary <string, string>();

            /**
             * 验证签名
             */
            if (!string.IsNullOrEmpty(resultString))
            {
                // 将返回结果转换为map
                resData = SDKUtil.CoverStringToDictionary(resultString);

                /*if (SDKUtil.validate(resData, encoding)) {
                 *  //logger.info("验证签名成功");
                 *
                 * } else {
                 *  //logger.info("验证签名失败");
                 * }*/
                // 打印返回报文
                //logger.info("打印返回报文:" + resultString);
            }
            return(resData);
        }