eBay API 'The operation has timed out' exception

414 views Asked by At

I want to download orders from eBay. I have created the necessary credentials on eBay's sandbox site and added the eBay dll references in my project as

eBay.Service
eBay.Service.SDK.Attribute

My code is following:

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;
    }
}

The problems is on this line:

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

as it throws an exception

The operation has timed out.

Does anyone know what might cause this?

0

There are 0 answers