Ebay Api异常被抓获

时间:2014-11-12 06:35:09

标签: c# .net ebay ebay-api

我想从Ebay下载订单。

我已在Ebays沙箱网站上创建了必要的凭据。

并在我的项目中添加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));

在这一行它抛出异常,

操作已经超时。

请帮忙......

0 个答案:

没有答案