Amazon GetAuthToken c#

问题描述 投票:0回答:1

我正在尝试从 Amazon Web Services 调用 GetAuthToken:

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>
amazon-mws
1个回答
2
投票

您有错误的ServiceURL设置。您不能将其设置为“mws.amazonservices.com”,您必须根据商店位置指定适当的 ServiceURL。使用以下设置之一(取自亚马逊库示例)或查看更完整的开发人员指南:

// 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";
© www.soinside.com 2019 - 2024. All rights reserved.