Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6916503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:36:41+00:00 2026-05-27T09:36:41+00:00

I have been playing with Amazon’s Product Advertising API, and I cannot get a

  • 0

I have been playing with Amazon’s Product Advertising API, and I cannot get a request to go through and give me data. I have been working off of this: http://docs.amazonwebservices.com/AWSECommerceService/2011-08-01/GSG/ and this: Amazon Product Advertising API signed request with Java

Here is my code. I generated the SOAP bindings using this: http://docs.amazonwebservices.com/AWSECommerceService/2011-08-01/GSG/YourDevelopmentEnvironment.html#Java

On the Classpath, I only have: commons-codec.1.5.jar

import com.ECS.client.jax.AWSECommerceService;
import com.ECS.client.jax.AWSECommerceServicePortType;
import com.ECS.client.jax.Item;
import com.ECS.client.jax.ItemLookup;
import com.ECS.client.jax.ItemLookupRequest;
import com.ECS.client.jax.ItemLookupResponse;
import com.ECS.client.jax.ItemSearchResponse;
import com.ECS.client.jax.Items;

public class Client {

    public static void main(String[] args) {
        
        String secretKey = <my-secret-key>;
        String awsKey = <my-aws-key>;
        
        System.out.println("API Test started");

        AWSECommerceService service = new AWSECommerceService();
        service.setHandlerResolver(new AwsHandlerResolver(
                secretKey)); // important
        AWSECommerceServicePortType port = service.getAWSECommerceServicePort();

        // Get the operation object:
        com.ECS.client.jax.ItemSearchRequest itemRequest = new com.ECS.client.jax.ItemSearchRequest();

        // Fill in the request object:
        itemRequest.setSearchIndex("Books");
        itemRequest.setKeywords("Star Wars");
        // itemRequest.setVersion("2011-08-01");
        com.ECS.client.jax.ItemSearch ItemElement = new com.ECS.client.jax.ItemSearch();
        ItemElement.setAWSAccessKeyId(awsKey);
        ItemElement.getRequest().add(itemRequest);

        // Call the Web service operation and store the response
        // in the response object:
        com.ECS.client.jax.ItemSearchResponse response = port
                .itemSearch(ItemElement);

        String r = response.toString();
        System.out.println("response: " + r);

        for (Items itemList : response.getItems()) {
            System.out.println(itemList);
            for (Item item : itemList.getItem()) {
                System.out.println(item);
            }
        }

        System.out.println("API Test stopped");

    }
}

Here is what I get back.. I was hoping to see some Star Wars books available on Amazon dumped out to my console :-/:

API Test started
response: com.ECS.client.jax.ItemSearchResponse@7a6769ea
com.ECS.client.jax.Items@1b5ac06e
API Test stopped

What am I doing wrong (Note that no "item" in the second for loop is being printed out, because its empty)? How can I troubleshoot this or get relevant error information?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:36:41+00:00Added an answer on May 27, 2026 at 9:36 am

    This ended up working (I had to add my associateTag to the request):

    public class Client {
    
        public static void main(String[] args) {
    
            String secretKey = "<MY_SECRET_KEY>";
            String awsKey = "<MY AWS KEY>";
    
            System.out.println("API Test started");
    
    
            AWSECommerceService service = new AWSECommerceService();
            service.setHandlerResolver(new AwsHandlerResolver(secretKey)); // important
            AWSECommerceServicePortType port = service.getAWSECommerceServicePort();
    
            // Get the operation object:
            com.ECS.client.jax.ItemSearchRequest itemRequest = new com.ECS.client.jax.ItemSearchRequest();
    
            // Fill in the request object:
            itemRequest.setSearchIndex("Books");
            itemRequest.setKeywords("Star Wars");
            itemRequest.getResponseGroup().add("Large");
    //      itemRequest.getResponseGroup().add("Images");
            // itemRequest.setVersion("2011-08-01");
            com.ECS.client.jax.ItemSearch ItemElement = new com.ECS.client.jax.ItemSearch();
            ItemElement.setAWSAccessKeyId(awsKey);
            ItemElement.setAssociateTag("th0426-20");
            ItemElement.getRequest().add(itemRequest);
    
            // Call the Web service operation and store the response
            // in the response object:
            com.ECS.client.jax.ItemSearchResponse response = port
                    .itemSearch(ItemElement);
    
            String r = response.toString();
            System.out.println("response: " + r);
    
            for (Items itemList : response.getItems()) {
                System.out.println(itemList);
    
                for (Item itemObj : itemList.getItem()) {
    
                    System.out.println(itemObj.getItemAttributes().getTitle()); // Title
                    System.out.println(itemObj.getDetailPageURL()); // Amazon URL
                }
            }
    
            System.out.println("API Test stopped");
    
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been playing with Google maps I had it working but when I
I have been playing with this webbrowser control example I got it working and
I have been playing with generics and was hoping I could get some feedback
I have been playing around with Dynamic Data but I find the filtering and
I have been playing about with iText to try get a list of embedded
I have been playing around with this and wanted to get a second opinion.
So, I have been playing around with Amazon Cloud (AWS) and I am trying
I have been playing with PostgreSQL's notification system and cannot for the life of
I have been playing around with the youtube API and node.js, so far I
I have been playing with XML and PHP, I have googled to get the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.