1

我想从 eBay 下载订单。我已经在 eBay 的沙盒网站上创建了必要的凭据,并在我的项目中添加了 eBay dll 引用作为

eBay.Service
eBay.Service.SDK.Attribute

我的代码如下:

public void Getorders()
{
    try
    {
        if (Context == null)
        {
            Context = AppSettingHelper.GetApiContext();
            Context.ApiLogManager = new ApiLogManager();
            Context.ApiLogManager.ApiLoggerList.Add(new eBay.Service.Util.FileLogger("Log.txt", true, true, true));
            Context.ApiLogManager.EnableLogging = true;
            Context.Site = eBay.Service.Core.Soap.SiteCodeType.US;
        }

        GetOrdersCall apicall = new GetOrdersCall(Context);

        TimeFilter fltr = new TimeFilter();
        int ProcessDays = setPropertyEbay.ProcessDays;
        DateTime Fromdate = DateTime.Now.AddDays(-ProcessDays);
        fltr.TimeFrom = Fromdate;  //System.DateTime.Now.AddDays(-ProcessDays);
        DateTime todate = DateTime.Now;
        fltr.TimeTo = todate;  //System.DateTime.Now;
        String Role = "Seller";  // setPropertyEbay.Role;
        String Status = setPropertyEbay.OrderStatusCode;

        OrderTypeCollection orders = apicall.GetOrders(fltr, (TradingRoleCodeType)Enum.Parse(typeof(TradingRoleCodeType), Role), (OrderStatusCodeType)Enum.Parse(typeof(OrderStatusCodeType), Status));

        Order objorder = new Order();
        objorder.GenerateOrderDataTable(orders, apicall);
    }
    catch (ApiException oApiEx)
    {
        //process exception ... pass to caller, implement retry logic here or in caller, whatever you want to do
        Console.WriteLine(oApiEx.Message);
        Console.ReadLine();

        return;
    }
    catch (SdkException oSdkEx)
    {
        // process exception ... pass to caller, implement retry logic here or in caller, whatever you want to do
        Console.WriteLine(oSdkEx.Message);
        Console.ReadLine();

        return;
    }
    catch (Exception oEx)
    {
        //process exception ... pass to caller, implement retry logic here or in caller, whatever you want to do
        Console.WriteLine(oEx.Message);
        Console.ReadLine();

        return;
    }
}

问题出在这一行:

OrderTypeCollection orders = apicall.GetOrders(fltr, (TradingRoleCodeType)Enum.Parse(typeof(TradingRoleCodeType), Role), (OrderStatusCodeType)Enum.Parse(typeof(OrderStatusCodeType), Status));

因为它抛出异常

操作已超时。

有谁知道这可能是什么原因?

4

0 回答 0