我正试图从我的PayPal帐户下拉交易。我在沙箱环境中成功拨打电话,但无法在现场进行复制。
我有一个C#控制台应用(定位框架4)。我添加的服务是:https://www.paypal.com/wsdl/PayPalSvc.wsdl
这是我的代码(显然只是迄今为止的概念证明):
static void Main(string[] args)
{
using (var client = new PayPalService.PayPalAPIInterfaceClient())
{
var credentials = new PayPalService.CustomSecurityHeaderType
{
Credentials = new PayPalService.UserIdPasswordType
{
Username = "MyUsername",
Password = "MyPassword",
Signature = "MySignature"
}
};
TransactionSearchReq request = new TransactionSearchReq();
request.TransactionSearchRequest = new TransactionSearchRequestType();
request.TransactionSearchRequest.StartDate = DateTime.Now.AddHours(-12);
request.TransactionSearchRequest.EndDate = DateTime.Now;
TransactionSearchResponseType transactionSearchResponseType = client.TransactionSearch(ref credentials, request);
}
}
端点
<endpoint address="https://api.paypal.com/2.0/" binding="wsHttpBinding"
bindingConfiguration="PayPalAPISoapBinding" contract="PayPayService.PayPalAPIInterface"
name="PayPalAPI" />
当我拨打电话时(最后一行代码)我收到错误:
An error occurred while receiving the HTTP response to https://api.paypal.com/2.0/. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.
我已经搜索了答案,但找不到任何解决问题的方法。我需要做的就是下载交易,不需要其他功能。
答案 0 :(得分:1)
您是否检查过您是否将请求发送到正确的端点?
此处有更多详情:https://developer.paypal.com/webapps/developer/docs/classic/api/endpoints/
更新:看起来端点确实是你的问题。您的代码使用的是用户名,密码和签名,但是您将端点设置为证书端点而不是签名端点。