客户要求获取Amazon的数据,解决方案是使用Amazon Web Services (AWS)
相关资源
http://www.awszone.com/index.aws
http://docs.amazonwebservices.com/AWSEcommerceService/2005-03-23/
http://developer.amazonwebservices.com/connect/index.jspa
1.在这里获取aws最新的wsdl, 这里使用的是2007-01-15版本.
2.使用Apache Axis的WSDL2Java来生成源文件. 在命令行中运行
java -cp "E:\test\axis.jar;E:\test\axis-ant.jar;E:\test\commons-discovery-0.2.jar;E:\test\commons-logging-1.0.4.jar;E:\test\jaxrpc.jar;E:\test\log4j-1.2.8.jar;E:\test\saaj.jar;E:\test\wsdl4j-1.5.1.jar" org.apache.axis.wsdl.WSDL2Java -v -W http://webservices.amazon.com/AWSECommerceService/2007-01-15/AWSECommerceService.wsdl -o E:\test\src
也可以使用Ant的wsdl2java来生成. 2007-01-15版本生成了171个文件, 版本不同,生成的文件个数也不同.
3.通过awszone可以看到请求结果xml, 也有代码生成的功能, 但是awszone的版本好象太低了,缺少一些新功能,比如TopSellers.
拿ItemLookup来说, awszone会自动给出一个SubscriptionId, 在 ResponseGroup中选择你要查找的内容.
要查找产品信息, 就可以选择Small , Medium , Large 中的一个.
要查找价格, 就可以选择OfferSummary ,Offers ,OfferFull 中的一个. 等等 ResponseGroup详细信息,可以参考这里.
IdType中的ASIN是Amazon对其收录产品的唯一编码.
在ItemId 中输入一个ASIN 比如 B000K8LV1O 就可以查询这个产品的相关信息了.
在Code It 选项卡中可以自动生成代码, 将自动生成的代码复制现在就可以使用了.
4.一般情况下,只需要将WSDL2Java生成的代码,和awszone自动生成的代码加入项目就可以使用AWS了.
AWS的请求响应过程一般如下:
java 代码
- AWSECommerceService locator = new AWSECommerceServiceLocator();
- AWSECommerceServicePortType service = locator.getAWSECommerceServicePort();
-
-
- ItemLookup itemLookup = new ItemLookup();
-
- ItemLookupRequest request = new ItemLookupRequest();
-
- itemLookup.setSubscriptionId ( SubscriptionId );
-
-
- request.setResponseGroup( new String[]{ "Small", "OfferSummary" } );
-
-
- request.setItemId( new String[]{"B000K8LV1O"} );
- request.setIdType("ASIN");
-
-
- itemLookup.setRequest ( new ItemLookupRequest [] { request } );
-
-
- ItemLookupResponse response = service.itemLookup ( itemLookup );
-
- Items[] itemsArray = response.getItems();
分享到:
相关推荐
Amazon Web Services in Action, Second Edition is a comprehensive introduction to computing, storing, and networking in the AWS cloud. Readers will find clear, relevant coverage of all the essential ...
Amazon Web Services in Action introduces you to computing, storing, and networking in the AWS cloud. You'll start with a broad overview of AWS and learn how to spin-up servers manually and from the ...
Website Hosting and Migration with Amazon Web Services: A Practical Guide to Moving Your Website to AWS What You’ll Learn Evaluate Amazon Web Services (AWS) offered on the platform that may benefit ...
Docker on Amazon Web Services is for you if you want to build, deploy, and operate applications using the power of containers, Docker, and Amazon Web Services. Basic understanding of containers and ...
AWS Amazon Web Services Tutorial The Ultimate Beginners Guide 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源...
亚马逊Web Services实战 演讲主题:亚马逊Web Services实战 演讲嘉宾:Jeff Barr 简介: Jeff Barr是亚马逊(Amazon)的云计算战略师,在该主题中,他将和与会者分享亚马逊企业级Web Services路线图,比如亚马逊...
Beginning Amazon Web Services with Node.js teaches any novice Node.js developer to configure, deploy, and maintain scalable small to large scale Node.js applications in Amazon Web Services. Hosting a ...
AWS Amazon Web Services Tutorial The Ultimate Beginners Guide 英文azw3 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
Learn Amazon Web Services in a Month of Lunches 英文无水印原版pdf pdf所有页面使用FoxitReader、PDF-XChangeViewer、SumatraPDF和Firefox测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn...
prepare for the Amazon Web Services (AWS) Certified SysOps Administrator – Associate exam:
Amazon Web Services in Action introduces you to computing, storing and networking in the AWS cloud. You'll start with a broad overview of AWS and learn how to spin up servers manually and from the ...
Amazon Web Services
Amazon Web Services (AWS) is a leader in public cloud computing, and was the first to offer a managed container platform in the form of the Elastic Container Service (ECS). Docker on Amazon Web ...
Amazon官方出版的移动开发Web服务指南,介绍了如何使用AWS服务开发iOS和Android应用程序。
现在,云是大多数企业 IT 战略的核心。许多企业发现,妥善规划的云迁移策略(“简单地搬运”)能够带来直接的业务收益...本白皮书介绍现代化 Amazon Web Services (AWS) 上的应用程序的优势以及如何开始您的这一旅程。
自2006年, Amazon Web Services (简称 AWS)开始以网络服务的形式向企业提供IT基础设施服务—— 这也就是如今广为人知的云计算。核心优势之一,在于其能够取代基础设施带来的前期投入,且可以极低成本根据业务需求...
Pro PowerShell for Amazon Web Services Pro PowerShell for Amazon Web Services