asp.net – 我是否需要一个新的PayPal API来支持.Net服务器上的T
我正在运行ASP.Net 4.5,但使用的是非常旧版本的PayPal SOAP api.引用的是paypal_base.dll,报告版本为4.3.1.0.调用API的代码具有引用的“using”语句:
我已经验证了PayPal api的调用,即此值
包括ssl3和tls1.2. 我指着“沙盒”模式. 但是当调用setExpressCheckout时,我得到一个运行时异常,说: 我已经下载了PayPal API Samples项目并使用相同的沙箱凭据,它可以正常工作.看着Fiddler,除了示例API调用到api-3t.sandbox.paypal.com之外,调用几乎相同,而我的代码转到api-aa.sandbox.paypal.com,但根据TLS 1.2准备就绪的文档,两个apis应该工作.除了在“live”和“sandbox”之间切换之外,我在任一API中都没有看到设置端点的任何地方. 在小提琴响应中,两者都表明: 我的代码和Samples API代码略有不同,示例使用: SetExpressCheckoutRequestType request = new SetExpressCheckoutRequestType(); populateRequestObject(request); //populate request data SetExpressCheckoutReq wrapper = new SetExpressCheckoutReq(); wrapper.SetExpressCheckoutRequest = request; Dictionary<string,string> configurationMap = Configuration.GetAcctAndConfig(); //set merchant config PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap); SetExpressCheckoutResponseType setECResponse = service.SetExpressCheckout(wrapper); //make the call 我的(再次,非常古老的代码看起来像这样): CallerServices caller = new CallerServices(); caller.APIProfile = SetProfile.ApplicationProfile; //set merchant config SetExpressCheckoutRequestType pp_request = new SetExpressCheckoutRequestType(); // Create the request details object pp_request.SetExpressCheckoutRequestDetails = new SetExpressCheckoutRequestDetailsType(); pp_request.SetExpressCheckoutRequestDetails.PaymentAction = paymentAction; pp_request.SetExpressCheckoutRequestDetails.PaymentActionSpecified = true; pp_request.SetExpressCheckoutRequestDetails.OrderTotal = new BasicAmountType(); pp_request.SetExpressCheckoutRequestDetails.OrderTotal.currencyID = currencyCodeType; pp_request.SetExpressCheckoutRequestDetails.OrderTotal.Value = paymentAmount; pp_request.SetExpressCheckoutRequestDetails.CancelURL = cancelURL; pp_request.SetExpressCheckoutRequestDetails.ReturnURL = returnURL; return (SetExpressCheckoutResponseType) caller.Call("SetExpressCheckout",pp_request); //do the call 示例代码有效,我的代码抛出SSL / TLS错误.我尝试升级到最新的SDK,但是已经发生了很多变化,迁移所有代码将付出相当大的努力. 从fiddler看来,即使使用旧的API,它似乎也在使用TLS 1.2,但是我得到了关于SSL / TLS连接的运行时异常.是因为端点不同吗?旧的API太旧了吗? 在此先感谢任何帮助 – 我希望避免迁移所有古老的代码! 编辑:我应该提到我使用的是UserName / Password / Signature凭证,而不是基于证书的凭据. 解决方法
由于.Net4.5支持TLS1.2,但它不是默认协议.你需要选择使用它.以下代码将使TLS 1.2成为默认值,请确保在连接到安全资源之前执行它:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- asp.net-mvc – 为什么MvcApplication.RegisterRoutes被定义
- asp.net-mvc – 如何传递特殊字符使ASP.NET MVC可以正确处理
- asp.net-mvc – 如何获取某些代码在ASP.NET MVC 2中的每个单
- asp.net-mvc – 在asp.net mvc actionlink中传递嵌套属性
- asp.net-mvc – 疑难解答反伪造令牌问题
- 有没有办法通过ASP.NET和app_offline.htm来显示图像?
- asp.net-mvc – Microsoft MVC 4,APIController和适当的RES
- asp.net-mvc – 在HtmlHelper扩展方法中访问HtmlHelper方法
- asp.net-mvc – 具有区域的Url.Action()返回空字符串
- asp.net-mvc-4 – ASP.NET帮助页面默认主页?