Amazon (AWS) - 请求必须包含参数 Signature

发布于 2024-09-03 14:07:13 字数 1004 浏览 3 评论 0原文

我正在努力完成我的第一段代码与 AWS 一起工作的最后部分 - 我已经做到了这一点,我在 VS 中附加了 Web 参考,这有这个

amazon.AWSECommerceService service = new amazon.AWSECommerceService();

// prepare an ItemSearch request
amazon.ItemSearchRequest request = new amazon.ItemSearchRequest();
request.SearchIndex = "DVD";
request.Title = "scream";
request.ResponseGroup = new string[] { "Small" };

amazon.ItemSearch itemSearch = new amazon.ItemSearch();
itemSearch.AssociateTag = "";
itemSearch.Request = new ItemSearchRequest[] { request };
itemSearch.AWSAccessKeyId = ConfigurationManager.AppSettings["AwsAccessKeyId"];

itemSearch.Request = new ItemSearchRequest[] { request };
ItemSearchResponse response = service.ItemSearch(itemSearch);

// write out the results
foreach (var item in response.Items[0].Item)
{
    Response.Write(item.ItemAttributes.Title + "<br>");
}

我收到错误

The request must contain the parameter Signature.

我知道你必须“签署”请求现在,但无法弄清楚我会在“哪里”执行此操作或如何执行?任何帮助非常感谢?

I'm struggling with the final part of getting my first bit of code working with the AWS - I have got this far, I attached the web reference in VS and this have this

amazon.AWSECommerceService service = new amazon.AWSECommerceService();

// prepare an ItemSearch request
amazon.ItemSearchRequest request = new amazon.ItemSearchRequest();
request.SearchIndex = "DVD";
request.Title = "scream";
request.ResponseGroup = new string[] { "Small" };

amazon.ItemSearch itemSearch = new amazon.ItemSearch();
itemSearch.AssociateTag = "";
itemSearch.Request = new ItemSearchRequest[] { request };
itemSearch.AWSAccessKeyId = ConfigurationManager.AppSettings["AwsAccessKeyId"];

itemSearch.Request = new ItemSearchRequest[] { request };
ItemSearchResponse response = service.ItemSearch(itemSearch);

// write out the results
foreach (var item in response.Items[0].Item)
{
    Response.Write(item.ItemAttributes.Title + "<br>");
}

I get the error

The request must contain the parameter Signature.

I know you have to 'sign' requests now, but can't figure out 'where' I would do this or how? any help greatly appreciated?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

墨落成白 2024-09-10 14:07:13

您必须添加到 SOAP 请求标头,包括您的 Amazon 访问密钥 ID、时间戳以及请求操作的 SHA256 哈希值和时间戳。为此,您需要在发送 SOAP 消息之前访问该消息。我在 http://flyingpies.wordpress 上整理了一个演练和示例项目。 com/2009/08/01/17/

You have to add to the SOAP request headers including your Amazon access key ID, a timestamp, and the SHA256 hash of the request operation and the timestamp. To accomplish that, you would need access to the SOAP message just before it is going to be sent out. There's a walkthrough and a sample project I put together at http://flyingpies.wordpress.com/2009/08/01/17/.

爱要勇敢去追 2024-09-10 14:07:13

郑重声明:

出现此错误的另一个原因是关键字中含有空格。

例子:

'http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=xxx&AssociateTag=usernetmax-20&Version=2011-08-01&Operation=ItemSearch&ResponseGroup=Medium,Offers& SearchIndex=全部&关键字=宝贝
婴儿车
&MerchantId=全部&Condition=全部&Availability=Available&ItemPage=1&Timestamp=2012-05-16T02:17:32Z&Signature=ye5c2jo99cr3%2BPXVkMyXX8vMhTC21UO4XfHpA21%2BUCs%3D'

nignate

'http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=xxx&AssociateTag=usernetmax-20&Version=2011-08-01&Operation=ItemSearch&ResponseGroup=Medium,Offers& SearchIndex=全部&关键字=Baby%20Stroller&MerchantId=全部&Condition=All&Availability=Available&ItemPage=1&Timestamp=2012-05-16T02:17:32Z&Signature=ye5c2jo99cr3% 2BPXVkMyXX8vMhTC21UO4XfHpA21%2BUC%3D'

PHP 解决方案:

$Keywords = str_replace(' ', '%20', $Keywords);

$Keywords = urlencode($Keywords);

For the record:

Another reason to get this error is due to keywords with spaces in it.

Example:

'http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=xxx&AssociateTag=usernetmax-20&Version=2011-08-01&Operation=ItemSearch&ResponseGroup=Medium,Offers&SearchIndex=All&Keywords=Baby
Stroller
&MerchantId=All&Condition=All&Availability=Available&ItemPage=1&Timestamp=2012-05-16T02:17:32Z&Signature=ye5c2jo99cr3%2BPXVkMyXX8vMhTC21UO4XfHpA21%2BUCs%3D'

It should be:

'http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=xxx&AssociateTag=usernetmax-20&Version=2011-08-01&Operation=ItemSearch&ResponseGroup=Medium,Offers&SearchIndex=All&Keywords=Baby%20Stroller&MerchantId=All&Condition=All&Availability=Available&ItemPage=1&Timestamp=2012-05-16T02:17:32Z&Signature=ye5c2jo99cr3%2BPXVkMyXX8vMhTC21UO4XfHpA21%2BUCs%3D'

PHP solution:

$Keywords = str_replace(' ', '%20', $Keywords);

or

$Keywords = urlencode($Keywords);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文