How to implement amazon api service?

I want to imlement amazon api web service to my application. I have implemente it but its gives error. The error is 'The request must contain the parameter Signature'. How can I solve it?
Thanks.
avacaralifeAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Vel EousResearch & Development ManagerCommented:
Take a look at the following two web pages:

1) http://developer.amazonwebservices.com/connect/ann.jspa?annID=483

Amazon documentation on the enforcement of signed API requests including developers guide and sample source code


2) http://richardcummings.info/AWS-Signature-Parameter-Convert.php

"AWS Signature Parameter Convert Utility" provided by someone who had a similar issue to yourself.

Hope this helps.
0
avacaralifeAuthor Commented:
Thanks Tchuki.

Right now I am implementing my web application in .net 2008. I have use the Amazon web service. the web service ULR is : http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl 

When I try to get Item details using ItemLookupRequest, It gives error.

The error is : "The request must contain the parameter Signature"

Show below is my code :


    protected void Button1_Click(object sender, EventArgs e)
    {
       //// Amazon.EC2.AmazonEC2Client c = new Amazon.EC2.AmazonEC2Client("", "");

        //have we this in the cache already?  
        com.amazon.webservices.ItemLookupResponse response;

        if (Cache[TextBox1.Text] == null)
        {
            com.amazon.webservices.AWSECommerceService aws = new com.amazon.webservices.AWSECommerceService();
            com.amazon.webservices.ItemLookupRequest request = new com.amazon.webservices.ItemLookupRequest();
            string lStrCertPath;
            //lStrCertPath=
            System.Security.Cryptography.X509Certificates.X509Certificate X509Certificate = new System.Security.Cryptography.X509Certificates.X509Certificate(Server.MapPath("") + "\\cert-364S3JDEKPEOT6VYWBFLVZPECE6QOVMT.pem");
            aws.ClientCertificates.Add(X509Certificate);

            request.SearchIndex = "Books";

            //request. = "title:" + TextBox1.Text;  
            request.ResponseGroup = new string[] { "Small" };
            //request.SearchIndex = "salesrank";

            com.amazon.webservices.ItemLookupRequest[] requests = new com.amazon.webservices.ItemLookupRequest[] { request };

            com.amazon.webservices.ItemLookup itemSearch = new com.amazon.webservices.ItemLookup();
            itemSearch.SubscriptionId = "6MmIULpFVdbxHgh7udwhcJyVOxhkSQpUeqp0SY/N";
            // itemSearch.AssociateTag = "AKIAIJP5BCYL7WMRMD5A";
            //  itemSearch.SubscriptionId = "AKIAJPMM324XXNMQ7AXQ";
            //itemSearch.SubscriptionId = "AKIAJPMM324XXNMQ7AXQ";
            itemSearch.AWSAccessKeyId = "AKIAIJP5BCYL7WMRMD5A";
            // itemSearch.Validate = "false";

            // itemSearch.AWSAccessKeyId = "AKIAJPMM324XXNMQ7AXQ";  
            itemSearch.Request = requests;
            //.ClientCertificates.Add(X509Certificate.CreateFromCertFile(X509CertFile));
            request.Condition = com.amazon.webservices.Condition.All;

            response = aws.ItemLookup(itemSearch);
            Cache.Insert(TextBox1.Text, response, null,
                DateTime.Now.AddHours(24), TimeSpan.Zero);
        }
        else
        {
            response = (com.amazon.webservices.ItemLookupResponse)Cache[TextBox1.Text];
        }
        com.amazon.webservices.Items info = response.Items[0];
        com.amazon.webservices.Item[] items = info.Item;
        Label1.Text = "";
        for (int i = 0; i < items.Length; i++)
        {
            com.amazon.webservices.Item item = items[i];
            Label1.Text += "Book Title: " + item.ItemAttributes.Title + "<br />";
        }
        GridView1.DataSource = AmazonToDataSet("title: " + TextBox1.Text);
        GridView1.DataBind();
       }
   
    public DataSet AmazonToDataSet(string PowerSearchString)
    {

        DataSet ds;

        //have we this in the cache already?  
        if (Cache[PowerSearchString] == null)
        {
            //create our query  
            com.amazon.webservices.ItemLookupResponse response =
                grabAmazonSearch(PowerSearchString);

            //Construct the dataset to store the results  
            ds = new DataSet();
            ds.Tables.Add();

            ds.Tables[0].Columns.Add("ProductName");
            ds.Tables[0].Columns.Add("AuthorName");
            ds.Tables[0].Columns.Add("Price");
            ds.Tables[0].Columns.Add("URL");

            com.amazon.webservices.Items info = response.Items[0];
            com.amazon.webservices.Item[] items = info.Item;
            DataRow dr;

            //iterate the results adding new rows with  
            //the values from the search result item.  

            for (int i = 0; i < items.Length; i++)
            {
                com.amazon.webservices.Item item = items[i];
                dr = ds.Tables[0].NewRow();
                dr["ProductName"] = item.ItemAttributes.Title;
                dr["AuthorName"] = item.ItemAttributes.Author[0];
                dr["Price"] = item.ItemAttributes.ListPrice;
                dr["URL"] = item.DetailPageURL;
                ds.Tables[0].Rows.Add(dr);
            }

            //add the dataset to the cache  
            Cache.Insert(PowerSearchString, ds, null,
                DateTime.Now.AddHours(24), TimeSpan.Zero);

        }
        else
        {
            ds = (DataSet)Cache[PowerSearchString];
        }
        //return the dataset  
        return ds;
    }


    private com.amazon.webservices.ItemLookupResponse grabAmazonSearch(string PowerSearchString)
    {
        com.amazon.webservices.ItemLookupResponse response;
        com.amazon.webservices.AWSECommerceService aws = new com.amazon.webservices.AWSECommerceService();
        com.amazon.webservices.ItemLookupRequest request = new com.amazon.webservices.ItemLookupRequest();

        request.SearchIndex = "Books";

        //request.Power = PowerSearchString;
        request.ResponseGroup = new string[] { "Small" };
        //request.Sort = "salesrank";

        com.amazon.webservices.ItemLookupRequest[] requests = new com.amazon.webservices.ItemLookupRequest[] { request };

        com.amazon.webservices.ItemLookup itemSearch = new com.amazon.webservices.ItemLookup();
        //itemSearch.AssociateTag = "myassociatetag-20";
        itemSearch.SubscriptionId = "AKIAIJP5BCYL7WMRMD5A";
//        itemSearch.AWSAccessKeyId = "AKIAJPMM324XXNMQ7AXQ";  
        itemSearch.Request = requests;

        response = aws.ItemLookup(itemSearch);

        return response;
    }


Give me solution As early as possible.

Thanks in advanse.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Vel EousResearch & Development ManagerCommented:
I've not dealt with AWS API myself which is why I provided the two links.

Perhaps you could provide more information such as which line is generating the error?  You can step through your code using F11 in Visual Studio and when it hits the offending line will automatically stop.

However from the reading I have done using the links I provided for YOU to look through, it can be determine that you require a HMAC-SHA signature concatinated to your API URL.

Take a look at these pages for further info:

// Product Advertising API documentation
http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/index.html?RequestAuthenticationArticle.html

// Signed request generator
http://associates-amazon.s3.amazonaws.com/signed-requests/helper/index.html

0
Challenges in Government Cyber Security

Has cyber security been a challenge in your government organization? Are you looking to improve your government's network security? Learn more about how to improve your government organization's security by viewing our on-demand webinar!

avacaralifeAuthor Commented:
Yes here is the screen shoot of error I have attached. look over it.
Error.png
0
Vel EousResearch & Development ManagerCommented:
Does your itemSearch object have a property or method called Signature?


itemSearch.Signature = "";

Open in new window

0
avacaralifeAuthor Commented:
No there is no signature property.
0
Vel EousResearch & Development ManagerCommented:
Basically that error message is informing you that your SOAP message does not have a value for a required parameter (web services can implemenet parameters however they can be specified as either IsRequired = true | false).

I did a further google search and turns out the parameter is part of the SOAP header rather than the SOAP body, take a look at the following web page which has been created by someone who has had the same issue or one very similar to yours and provides information regarding a resolution.

http://flyingpies.wordpress.com/2009/08/01/17/


This following page might also be of use to you.

http://apisigning.com/
0
Vel EousResearch & Development ManagerCommented:
I would be curious to know just what the resolution was as I feel the information I provided was valid in relation to the question and subsequent information provided.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
WCF

From novice to tech pro — start learning today.