Amazonclientw

  • Uploaded by: Jose Torres
  • 0
  • 0
  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Amazonclientw as PDF for free.

More details

  • Words: 173
  • Pages: 1
import import import import import import import import import import import import

awsClient.AWSECommerceService; awsClient.AWSECommerceServicePortType; awsClient.ItemSearchRequest; awsClient.ItemSearch; awsClient.Items; awsClient.Item; awsClient.OperationRequest; awsClient.SearchResultsMap; awsClient.AwsHandlerResolver; javax.xml.ws.Holder; java.util.List; java.util.ArrayList;

class AmazonClientW { // W is for Wrapped style public static void main(String[] args) { if (args.length < 2) { System.err.println("Usage: java -cp . wrapped.TheClient <secretkey>"); return; } final String access_key = args[0]; final String secret_key = args[1]; // Construct a service object to get the port object. AWSECommerceService service = new AWSECommerceService(); service.setHandlerResolver(new AwsHandlerResolver(secret_key)); AWSECommerceServicePortType port = service.getAWSECommerceServicePort(); // Construct an empty request object and then add details. ItemSearchRequest request = new ItemSearchRequest(); request.setSearchIndex("Books"); request.setKeywords("quantum gravity"); ItemSearch search = new ItemSearch(); search.getRequest().add(request); search.setAWSAccessKeyId(access_key); Holder operation_request = null; Holder> items = new Holder>(); port.itemSearch(search.getMarketplaceDomain(), search .getAWSAccessKeyId(), search.getSubscriptionId(), search .getAssociateTag(), search.getXMLEscaping(), search .getValidate(), search.getShared(), search.getRequest(), operation_request, items); // Unpack the response to print the book titles. Items retval = items.value.get(0); // first and only Items element List item_list = retval.getItem(); // list of Item subelements for (Item item : item_list) // each Item in the list System.out.println(item.getItemAttributes().getTitle()); }

}

Related Documents

Amazonclientw
June 2020 9

More Documents from "Jose Torres"