[C#] 纯文本查看 复制代码
//官方查询结果xml
[WebMethod ]
public OrderNciis GetNciisResult(string onName, string onId)
{
//获取授权文件
string inLicense = LotteryMethods.GetContext(11);
//生成的WSDL类()
nciicGetCondition objText = new nciicGetCondition();
//获取基础URL
objText.Url = LotteryMethods.GetContext(12);
//编码
objText.RequestEncoding = Encoding.UTF8;
//创建证书文件
X509Certificate objx509 = new X509Certificate(System.Configuration.ConfigurationSettings.AppSettings["cd"].ToString().Trim());
//证书
objText.ClientCertificates.Add(objx509);
//方式可有可无
objText.UserAgent = "Client Cert Sample";
//读XML文件
string inConditions = OrderNciisXml(onName, onId);
//返回查询结果XML
OrderNciis model = new OrderNciis();
model.onLottery = objText.nciicCheck(inLicense, inConditions);
return model;
}
[C#] 纯文本查看 复制代码
private static bool RemoteCertificateValidate(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error){
// trust any certificate!!!
System.Console.WriteLine("Warning, trust any certificate");
//为了通过证书验证,总是返回true
return true;
}