我想在CompleteSaleRequest中更新TrackingInformation,但它返回“无效的作业上下文类型”
怎么了?有人有提示吗?
请求:
<?xml version="1.0" encoding="UTF-8"?>
<CompleteSaleRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<RequesterCredentials>
<eBayAuthToken>ABC...123</eBayAuthToken>
</RequesterCredentials>
<Shipped>true</Shipped>
<ItemID>1234567890</ItemID>
<TransactionID>99999999999</TransactionID>
<OrderID>1234567890-99999999999</OrderID>
<Shipment>
<ShipmentTrackingDetails>
<ShipmentTrackingNumber>12345678987654321</ShipmentTrackingNumber>
<ShippingCarrierUsed>DHL</ShippingCarrierUsed>
</ShipmentTrackingDetails>
</Shipment>
</CompleteSaleRequest>
响应:
<?xml version="1.0" encoding="UTF-8"?>
<GetOrdersResponse xmlns="urn:ebay:apis:eBLBaseComponents">
<Timestamp>2016-03-08T20:58:58.831Z</Timestamp>
<Ack>Failure</Ack>
<Errors>
<ShortMessage>Invalid job context type</ShortMessage>
<LongMessage>The job context object is not supported by Action Service Framework.</LongMessage>
<ErrorCode>21843</ErrorCode>
<SeverityCode>Error</SeverityCode>
<ErrorParameters ParamID="0">
<Value>GetOrders</Value>
</ErrorParameters>
<ErrorParameters ParamID="1">
<Value>CompleteSaleRequestType</Value>
</ErrorParameters>
<ErrorClassification>RequestError</ErrorClassification>
</Errors>
<Version>953</Version>
<Build>E953_INTL_APIXO_17829668_R1</Build>
</GetOrdersResponse>
答案 0 :(得分:1)
如果您查看eBay的回复,您会看到它包含在 GetOrdersResponse 元素中。由于您正在调用 CompleteSale 操作,因此您希望它位于 CompleteSaleResponse 元素中。原因在于eBay如何路由API请求。由于所有操作都转到同一个URL,因此服务器需要一种方法来确定您要调用的操作。这是通过查看请求的 HTTP标头来完成的。在此路由期间,将忽略正文的内容。 HTTP标头 X-EBAY-API-CALL-NAME 的值应包含您要调用的操作的名称。我希望目前它是 GetOrders 。如果您将标题设置为 CompleteSale ,则操作将被路由更正,您应该得到正确的响应。