5

我正在使用 Amazon API 并在将我的库存从我的数据库更新到 Amazon 网站时收到此错误:

Caught Exception: Internal Error
Response Status Code: 0
Error Code:
Error Type:
Request ID:
XML:

我读了这个线程(amazonsellercommunity.com/forums/thread.jspa?messageID=2194823),然后得到错误解释:

<Error><Type>Sender</Type><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.</Message><Detail/></Error>

所以我认为我的 MARKETPLACE_ID、MERCHANT_ID、AWS_ACCESS_KEY_ID 或 AWS_SECRET_ACCESS_KEY 可能是错误的。但我检查了这些信息是正确的。

实际上,我不明白为什么会发生此错误...之前,它运行良好,几天后它就崩溃了。而且我不会更改代码中的任何内容。奇怪,不是吗?

编辑 :

这是我的签名部分代码。

define ('DATE_FORMAT', 'Y-m-d\TH:i:s\Z');
define('AWS_ACCESS_KEY_ID', 'ABC...'); // My AWS Access Key Id (20 characters)
define('AWS_SECRET_ACCESS_KEY', 'ABCDEF...'); // My AWS Secret Access Key (40 characters)
define('APPLICATION_NAME', 'MyCompany_AmazonMWS');
define('APPLICATION_VERSION', '0.0.1');
define ('MERCHANT_ID', 'XXXXXXX'); // My Merchant ID
define ('MARKETPLACE_ID', 'XXXXXXX'); // My Marketplace ID

$config = array (
'ServiceURL' => "https://mws.amazonservices.fr",
'ProxyHost' => null,
'ProxyPort' => -1,
'MaxErrorRetry' => 3,
);

$service = new MarketplaceWebService_Client(
AWS_ACCESS_KEY_ID,
AWS_SECRET_ACCESS_KEY,
$config,
APPLICATION_NAME,
APPLICATION_VERSION
);

$parameters = array (
'Marketplace' => MARKETPLACE_ID,
'Merchant' => MERCHANT_ID,
'FeedType' => '_POST_INVENTORY_AVAILABILITY_DATA_',
'FeedContent' => $feedHandle,
'PurgeAndReplace' => false,
'ContentMd5' => base64_encode(md5(stream_get_contents($feedHandle), true)),
);

// and then I do this:

$request = new MarketplaceWebService_Model_SubmitFeedRequest($parameters);
invokeSubmitFeed($service, $request);

如果您想查看我的代码的某些部分,请询问。

先感谢您。

4

3 回答 3

2

如果我没记错的话,亚马逊 API 的身份验证机制对您机器上的当前日期/时间(在签署请求的过程中使用)很敏感。检查您的日期/时间是否设置正确。

于 2012-10-10T16:14:52.147 回答
1

对我来说,这只是我的网络应用程序传递 url 转义字符串的错误。亚马逊不喜欢特殊字符,出现了这个(不是那么有用)错误。确保您的文件名没有 url 转义字符。

于 2013-12-27T18:12:29.713 回答
0

我使用以下方法解决了它(在 Ubuntu 14.04 服务器上)ntpdate

首先确保它已安装:

apt-get install ntpdate 

然后执行:

ntpdate ntp.ubuntu.com
于 2017-06-10T16:11:47.653 回答