Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
asp.net亚马逊项目搜索_Asp.net_Amazon - Fatal编程技术网

asp.net亚马逊项目搜索

asp.net亚马逊项目搜索,asp.net,amazon,Asp.net,Amazon,我正在使用VisualStudio2008,并尝试进行API项目搜索,比如书籍之类的。 我只使用accessKeyId,但当我单击“搜索”按钮搜索书籍时,出现签名错误。 我也需要使用secretKeyID吗? 我刚刚在VisualStudio中创建了新的ASP.Net网站,还是我必须使用AWS SDK for.Net软件包 谁能给个好建议吗。 谢谢 签名错误表示您没有正确创建请求签名。您应该使用.NET的SprightlySoft AWS组件。它是免费的,并且支持产品广告API。把它弄到手。AW

我正在使用VisualStudio2008,并尝试进行API项目搜索,比如书籍之类的。 我只使用accessKeyId,但当我单击“搜索”按钮搜索书籍时,出现签名错误。 我也需要使用secretKeyID吗? 我刚刚在VisualStudio中创建了新的ASP.Net网站,还是我必须使用AWS SDK for.Net软件包

谁能给个好建议吗。
谢谢

签名错误表示您没有正确创建请求签名。您应该使用.NET的SprightlySoft AWS组件。它是免费的,并且支持产品广告API。把它弄到手。AWS SDK for.NET不适用于产品广告API

下面是一个使用SprightlySoft组件调用ItemSearch的示例

//Product Advertising API, ItemSearch: http://docs.amazonwebservices.com/AWSECommerceService/2010-10-01/DG/ItemSearch.html

SprightlySoftAWS.REST MyREST = new SprightlySoftAWS.REST();

String RequestURL;
RequestURL = "https://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&Operation=ItemSearch&Version=2010-10-01";
RequestURL += "&AWSAccessKeyId=" + System.Uri.EscapeDataString(TextBoxAWSAccessKeyId.Text) + "&SignatureVersion=2&SignatureMethod=HmacSHA256&Timestamp=" + Uri.EscapeDataString(DateTime.UtcNow.ToString("yyyy-MM-dd\\THH:mm:ss.fff\\Z"));
RequestURL += "&Actor=" + System.Uri.EscapeDataString("Tom Cruise");
RequestURL += "&SearchIndex=DVD";
RequestURL += "&ResponseGroup=" + System.Uri.EscapeDataString("ItemAttributes,Reviews");
RequestURL += "&Sort=salesrank";
RequestURL += "&ItemPage=1";

String RequestMethod;
RequestMethod = "GET";

String SignatureValue;
SignatureValue = MyREST.GetSignatureVersion2Value(RequestURL, RequestMethod, "", TextBoxAWSSecretAccessKey.Text);

RequestURL += "&Signature=" + System.Uri.EscapeDataString(SignatureValue);

Boolean RetBool;
RetBool = MyREST.MakeRequest(RequestURL, RequestMethod, null);
System.Diagnostics.Debug.Print(MyREST.LogData);

String ResponseMessage = "";

if (RetBool == true)
{
    System.Xml.XmlDocument MyXmlDocument;
    System.Xml.XmlNamespaceManager MyXmlNamespaceManager;
    System.Xml.XmlNode MyXmlNode;
    System.Xml.XmlNodeList MyXmlNodeList;

    MyXmlDocument = new System.Xml.XmlDocument();
    MyXmlDocument.LoadXml(MyREST.ResponseString);

    MyXmlNamespaceManager = new System.Xml.XmlNamespaceManager(MyXmlDocument.NameTable);
    MyXmlNamespaceManager.AddNamespace("amz", "http://webservices.amazon.com/AWSECommerceService/2010-10-01");

    MyXmlNodeList = MyXmlDocument.SelectNodes("amz:ItemSearchResponse/amz:Items/amz:Item", MyXmlNamespaceManager);

    if (MyXmlNodeList.Count == 0)
    {
        ResponseMessage = "No items exist.";
    }
    else
    {
        foreach (System.Xml.XmlNode ItemXmlNode in MyXmlNodeList)
        {
            MyXmlNode = ItemXmlNode.SelectSingleNode("amz:ItemAttributes/amz:Title", MyXmlNamespaceManager);
            ResponseMessage += "Title = " + MyXmlNode.InnerText;

            MyXmlNode = ItemXmlNode.SelectSingleNode("amz:ItemAttributes/amz:ListPrice/amz:FormattedPrice", MyXmlNamespaceManager);
            ResponseMessage += "   ListPrice = " + MyXmlNode.InnerText;

            ResponseMessage += Environment.NewLine;
        }
    }

    MessageBox.Show(ResponseMessage); 
}
else
{
    MessageBox.Show(MyREST.ResponseStringFormatted);
}