2016-03-08 41 views
1

我想在CompleteSaleRequest內更新TrackingInformation但它返回「無效的工作上下文類型」的eBay API CompleteSaleRequest失敗,錯誤代碼21843

有什麼不對?任何人都有提示?

請求:

<?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

如果你看一下來自eBay的反應,你會看到,它被包裹在GetOrdersResponse元素。由於您正在致電CompleteSale操作,因此您會預計它將位於CompleteSaleResponse元素中。原因將在於eBay如何路由API請求。由於所有操作都轉到相同的URL,因此服務器需要一種方法來確定您正在調用哪個操作。這通過查看請求的HTTP標頭來完成。在此路由過程中,主體的內容被忽略。 HTTP頭X-EBAY-API-CALL-NAME的值應包含您正在調用的操作的名稱。我預計目前它是GetOrders。如果您將標頭設置爲CompleteSale,則操作將被糾正並且您應該得到正確的響應。

+0

嘿大衛,那正是問題!謝謝你的解釋,你救了我的一天! – user1350963

相關問題