2014-10-03 137 views
1

我想從亞馬遜Web服務調用GetAuthToken:亞馬遜GetAuthToken C#

http://docs.developer.amazonservices.com/en_US/auth_token/AuthToken_GetAuthToken.html

我檢查了C#客戶端庫,我找不到GetAuthToken的方法。這是否已經實施?我試圖做一個沒有庫的POST請求,它失敗了。這是我的請求和響應,我手動寫道:

請求

POST https://mws.amazonservices.com/ HTTP/1.1 
Content-Type: application/x-www-form-urlencoded 
Host: mws.amazonservices.com 
Content-Length: 238 
Expect: 100-continue 
Connection: Keep-Alive 

AWSAccessKeyId=XX&Action=GetAuthToken&SellerId=XX&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2014-09-01T16%3A41%3A16Z&Version=2011-07-01&Signature=vRBxMEXAMPLES2y0FGPufG4u7WY2HqhcsYUW6IVI9%2BQ%3D 

響應:

HTTP/1.1 404 Not Found 
Date: Fri, 03 Oct 2014 17:14:53 GMT 
Server: AmazonMWS 
x-mws-request-id: 1a0bd189-d3e9-40b8-a55d-a420c9ed4805 
x-mws-timestamp: 2014-10-03T17:14:54.195Z 
x-mws-response-context: VaGpX6JmTb+cM7WqwM6Fs8/E4oExbxl5c7li/EU0ho2j0/WpcYuG1XZSQzkuyrlr+kVTKBdKeG6F 3nwhM5s2gg== 
Content-Type: text/xml 
Content-Length: 368 
Vary: User-Agent 

<?xml version="1.0"?> 
<ErrorResponse xmlns="https://mws.amazonservices.com/"> 
<Error> 
    <Type>Sender</Type> 
    <Code>InvalidAddress</Code> 
    <Message>Resource/is not found on this server. API Section is missing or you have provided an invalid operation name.</Message> 
</Error> 
<RequestID>1a0bd189-d3e9-40b8-a55d-a420c9ed4805</RequestID> 
</ErrorResponse> 

回答

1

你有錯的serviceUrl設置。您不能將其作爲「mws.amazonservices.com」,您必須根據商店位置指定適當的ServiceURL。使用以下設置之一(取自Amazon庫樣品)或查看更完整的開發人員指南:

// North America: 
$serviceUrl = "https://mws.amazonservices.com/Products/2011-10-01"; 

// Europe 
$serviceUrl = "https://mws-eu.amazonservices.com/Products/2011-10-01"; 

// Japan 
$serviceUrl = "https://mws.amazonservices.jp/Products/2011-10-01"; 

// China 
$serviceUrl = "https://mws.amazonservices.com.cn/Products/2011-10-01";