GetOrders API调用在Ebay沙箱帐户上没有返回任何订单

时间:2015-04-24 08:20:45

标签: java ebay-api

我已将测试订单放在沙盒Ebay帐户中,但我无法从GetOrder调用中获取订单详细信息。我收到了成功消息,但没有获取订单。有人能帮助我吗?

这是我的代码:

for (UINT y = 0; y < 3000; ++y)
    {
        //one scanline at a time because bitmaps are stored wrong way up
        byte* oRow = (byte*)bitmapData1.Scan0 + (y * bitmapData1.Stride);
        for (UINT x = 0; x < 4000; ++x)
        {
            //get grey value from 0.114*Blue + 0.299*Red + 0.587*Green
            byte grey = (oRow[x * 3] * .114) + (oRow[x * 3 + 1] * .587) + (oRow[x * 3 + 2] * .299); //THIS LINE IS THE HIGHLIGHTED ONE

            //rest of manipulation code
        }
    }

这是请求XML:

private static ApiContext getApiContext() throws IOException {

    String input;
    ApiContext apiContext = new ApiContext();
    // set devId, appId, certId in ApiAccount
    ApiAccount account = new ApiAccount();
    account.setDeveloper("xxxx");
    account.setApplication("xxxxx");
    account.setCertificate("xxxxxx");

    ApiCredential cred = apiContext.getApiCredential();
    cred.setApiAccount(account);

    cred.seteBayToken("xxxxxxxxxxx");

    apiContext.setApiServerUrl("https://api.sandbox.ebay.com/wsapi");

    apiContext.setWSDLVersion("897");

    return apiContext;

public static void main(String[] args) {

    try {

        System.out.println("===== [1] Account Information ====");
        ApiContext apiContext = getApiContext();
        GetOrdersCall orders = new GetOrdersCall(apiContext);
        SimpleDateFormat formatter = new SimpleDateFormat("E MMM dd HH:mm:ss z yyyy");

        String Startdate = "Wed Apr 20 12:53:10 IST 2015";  
        String Enddate = "Fri Apr 27 12:53:10 IST 2015";

        Date date1 = formatter.parse(Startdate);
        System.out.println(date1);

        Date date2 = formatter.parse(Enddate);
        System.out.println(date2);
        Calendar calFrom=Calendar.getInstance();
        Calendar calTo=Calendar.getInstance();
        calFrom.setTime(date1);
        orders.setCreateTimeFrom(calFrom);
        calTo.setTime(date2);
        orders.setCreateTimeTo(calTo);
        orders.setWarningLevel(WarningLevelCodeType.HIGH);
        orders.setOrderRole(TradingRoleCodeType.SELLER);
        orders.setOrderStatus(OrderStatusCodeType.ACTIVE);

        OrderType[] os = orders.getOrders();
        System.out.println("Length"+os.length);


        System.out.println(orders.getRequestXml()+orders.getResponseXml());
        for(OrderType o:os){
            System.out.println(o.getOrderID());
        }
    }

    catch(Exception e) {
        System.out.println("Fail to get order the item.");
        e.printStackTrace();
    }

响应XML:

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">

 <S:Header>
  <ebl:RequesterCredentials xmlns:ebl="urn:ebay:apis:eBLBaseComponents" 
                            xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
                            SOAP-ENV:mustUnderstand="0">
   <ebl:eBayAuthToken>xxxxx</ebl:eBayAuthToken>
</ebl:RequesterCredentials>
 </S:Header>
 <S:Body>
  <GetOrdersRequest xmlns="urn:ebay:apis:eBLBaseComponents">
   <Version>897</Version>

   <WarningLevel>High</WarningLevel>

   <CreateTimeFrom>2015-04-18T12:53:10+05:30</CreateTimeFrom>


   <CreateTimeTo>2015-04-25T12:53:10+05:30</CreateTimeTo>

   <OrderRole>Seller</OrderRole>

   <OrderStatus>Active</OrderStatus>

  </GetOrdersRequest>
 </S:Body>
</S:Envelope>

2 个答案:

答案 0 :(得分:1)

尝试将orderStatus设置为all。 ebay api中的订单状态不是那么清楚。

http://developer.ebay.com/Devzone/XML/docs/Reference/ebay/types/OrderStatusCodeType.html

答案 1 :(得分:0)

感谢您回答我的问题。我得到了答案,实际上我的代码是正确的,但错误的是我购买了那些已经列出(或由其他人列出)的产品,而不是我列出的产品(我的eaby sandbox id)。