C# Amazon(AWS)-请求必须包含参数签名
我正在努力完成我的第一段AWS代码的最后一部分-我已经完成了这一步,我在VS中附加了web参考,这有C# Amazon(AWS)-请求必须包含参数签名,c#,amazon-web-services,soap,amazon-product-api,C#,Amazon Web Services,Soap,Amazon Product Api,我正在努力完成我的第一段AWS代码的最后一部分-我已经完成了这一步,我在VS中附加了web参考,这有 amazon.AWSECommerceService service = new amazon.AWSECommerceService(); // prepare an ItemSearch request amazon.ItemSearchRequest request = new amazon.ItemSearchRequest(); request.SearchIndex = "DVD"
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>");
}
我知道你现在必须“签署”请求,但不知道“在哪里”我会这样做或如何做?非常感谢您的帮助?您必须添加到SOAP请求头中,包括您的Amazon访问密钥ID、时间戳以及请求操作的SHA256哈希和时间戳。要实现这一点,您需要在发送SOAP消息之前访问它。有一个演练和一个示例项目我放在一起。记录在案: 出现此错误的另一个原因是关键字中有空格 例如: "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 婴儿车&MerchantId=All&Condition=All&Availability=Available&ItemPage=1&Timestamp=2012-05-16T02:17:32Z&Signature=ye5c2jo99cr3%2BPXVKMYX8VMHTC21O4XFHPA21%2BUCs%3D' 应该是: "http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=xxx&AssociateTag=usernetmax-20&Version=2011-08-01&Operation=ItemSearch&ResponseGroup=Medium,提供和搜索索引=全部和关键字=婴儿%20控制者&MerchantId=All&Condition=All&Availability=Available&ItemPage=1&Timestamp=2012-05-16T02:17:32Z&Signature=ye5c2jo99cr3%2bpxvkmyxx8vmhtc21oo4xfhpa21%2BUCs%3D PHP解决方案:
$Keywords = str_replace(' ', '%20', $Keywords);
或
您好-我在发布这篇文章之前遵循了您的教程,但无法在我的web应用程序中使用它。每次它都无法理解什么是AWSECommerceServicePortTypeClient?最后,我设法从Amazon上获得了一些示例代码,但我不得不安装Microsoft WSE 3.0并删除我的web引用:要让一些简单的东西工作起来,这简直是疯狂的工作量!!!leen3o你的代码运行了吗?我也有同样的问题。你能帮我吗??
$Keywords = str_replace(' ', '%20', $Keywords);
$Keywords = urlencode($Keywords);