gpt4 book ai didi

java - GetOrders API 调用在 Ebay 沙盒帐户上未返回任何订单

转载 作者:搜寻专家 更新时间:2023-10-31 20:33:44 25 4
gpt4 key购买 nike

我已经在沙盒 Ebay 帐户中下了测试订单,但我无法从 GetOrder 调用中获取订单详细信息。我收到成功消息,但未获取任何订单。有人可以帮助我吗?

这是我的代码:

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>

响应 XML:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<GetOrdersResponse xmlns="urn:ebay:apis:eBLBaseComponents">
<Timestamp>2015-04-24T07:03:42.662Z</Timestamp>
<Ack>Success</Ack>
<Version>915</Version>
<Build>E915_CORE_API_17441756_R1</Build>
<PaginationResult>
<TotalNumberOfPages>0</TotalNumberOfPages>
<TotalNumberOfEntries>0</TotalNumberOfEntries>
</PaginationResult>
<HasMoreOrders>false</HasMoreOrders>
<OrderArray/>
<OrdersPerPage>100</OrdersPerPage>
<PageNumber>1</PageNumber>
<ReturnedOrderCountActual>0</ReturnedOrderCountActual>
</GetOrdersResponse>
</soapenv:Body>
</soapenv:Envelope>

最佳答案

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

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

关于java - GetOrders API 调用在 Ebay 沙盒帐户上未返回任何订单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29842232/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com