using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
using System.Threading.Tasks;
namespace GetHttpData.SDK
{
public class HttpDataHelper
{
#region 方法 -> 通过Json方式添加数据
///
/// 通过Json方式添加数据
/// Mr.Cai 2018-1-3
///
/// 完整请求地址
/// 接口名字
/// 表名
/// 授权码
/// json参数数组
/// 其它参数
///
public static string InsertDataByJson(string ipAddress, string interfaceName,
string tableName, string code, string josnString, string orderString = "")
{
if (string.IsNullOrEmpty(ipAddress) || string.IsNullOrEmpty(interfaceName)
|| string.IsNullOrEmpty(tableName) || string.IsNullOrEmpty(josnString))
{
throw new Exception("请求地址、接口名、表名或请求参数不可为空!");
}
try
{
string[] args = { code, tableName, josnString, orderString };
return WSHelper.InvokeWebService(ipAddress, interfaceName, args).ToString();
}
catch (Exception ex)
{
throw new Exception("网络请求失败:" + ex.ToString());
}
}
#endregion
}
}