苏飞论坛

标题: C# wsdl转化成实体类后,不知道怎么调用带有证书的webservices接口 [打印本页]

作者: 小黑黑    时间: 2016-2-27 22:58
标题: C# wsdl转化成实体类后,不知道怎么调用带有证书的webservices接口
C# wsdl转化成实体类后,不知道怎么调用带有证书的webservices接口
string str = @"{beParam:{parkingno:2015091601},mm:password,ownerId:2015091601,serviceId:10}";
            var Request = new ParaRequest()
                          {
                              psBuff = str
                          };
            //调用接口,发送扣款请求,返回请求结果
            var client = new ParkingFrontServerPortTypeClient();
            //创建证书文件
            string certificaPath = Application.StartupPath + "\\Certificate\\ca.p12";
            string certificaPath2 = Application.StartupPath + "\\Certificate\\client.p12";
            //  X509Certificate objx509 = new X509Certificate(certificaPath, "12345678");
            var tmp = client.ClientCredentials.ClientCertificate;
            //X509Certificate2 tmp1 = new X509Certificate2(certificaPath2, "12345678");
            //X509Certificate2 tmp2 = new X509Certificate2(certificaPath, "12345678");
            tmp.Certificate = new X509Certificate2();
            tmp.Certificate.Import(certificaPath, "12345678", X509KeyStorageFlags.MachineKeySet);
            tmp.Certificate.Import(certificaPath2, "12345678", X509KeyStorageFlags.MachineKeySet);
             System.Net.ServicePointManager.DefaultConnectionLimit = 50;
            ParaResponse deductionResponse = client.getParkingPara(Request);

报错:
“System.ServiceModel.Security.SecurityNegotiationException”类型的未经处理的异常在 mscorlib.dll 中发生
其他信息: 无法使用颁发机构“218.201.47.12:33101”建立 SSL/TLS 的安全通道。


请问各位大神怎么处理!!!!!





欢迎光临 苏飞论坛 (http://www.sufeinet.com/) Powered by Discuz! X3.4