该请求必须包含参数Signature
我正在努力获得我的第一个代码与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.
我知道你现在必须'签字'请求,但是不知道'我会在哪里做这个或者怎么做'? 任何帮助非常感谢?
您必须添加到SOAP请求标头中,包括您的Amazon访问密钥ID,时间戳和请求操作的SHA256散列以及时间戳。 为了实现这一点,您需要在即将发送之前访问SOAP消息。 有一个演练和我在http://flyingpies.wordpress.com/2009/08/01/17/放在一起的示例项目。
作为记录:
导致此错误的另一个原因是由于其中包含空格的关键字。
例:
'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= 婴儿手推车和MerchantId =全部和条件=全部和可用性=可用&ItemPage = 1&时间戳= 2012-05-16T02:17:32Z&签名= ye5c2jo99cr3%2BPXVkMyXX8vMhTC21UO4XfHpA21%2BUCs%3D”
它应该是:
'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= 婴儿%20Stroller &MerchantId =全部&条件=全部&可用性=可用&ItemPage = 1&时间戳= 2012-05-16T02:17:32Z&签名= ye5c2jo99cr3%2BPXVkMyXX8vMhTC21UO4XfHpA21%2BUCs%3D”
PHP解决方案:
$Keywords = str_replace(' ', '%20', $Keywords);
要么
$Keywords = urlencode($Keywords);
链接地址: http://www.djcxy.com/p/1017.html