`
wangcheng
  • 浏览: 1453767 次
  • 性别: Icon_minigender_1
  • 来自: 青岛人在北京
社区版块
存档分类
最新评论

Amazon Web Services

阅读更多

客户要求获取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 代码
  1. AWSECommerceService locator = new AWSECommerceServiceLocator();   
  2. AWSECommerceServicePortType service = locator.getAWSECommerceServicePort();   
  3.   
  4. //ItemLookup代表请求的AWS方法,如ItemSearch, BrowseNodeLookup等都可以   
  5. ItemLookup itemLookup = new ItemLookup();   
  6. //创建ItemLookup相应的Request对象   
  7. ItemLookupRequest request = new ItemLookupRequest();   
  8. //设置SubscriptionId    
  9. itemLookup.setSubscriptionId ( SubscriptionId );   
  10.   
  11. //设置你需要AWS返回哪些数据,这些值可以在'ResponseGroup详细信息'中选择   
  12. request.setResponseGroup( new String[]{ "Small""OfferSummary" } );   
  13.   
  14. //设置查询条件,输入ASIN号   
  15. request.setItemId( new String[]{"B000K8LV1O"} );   
  16. request.setIdType("ASIN");   
  17.   
  18. // Setup request   
  19. itemLookup.setRequest ( new ItemLookupRequest [] { request } );   
  20.   
  21. //获取AWS的响应, 你所需要的数据都在response里了.   
  22. ItemLookupResponse response = service.itemLookup ( itemLookup );   
  23. //Response实际上是帮助你解析XML中的数据而已.   
  24. Items[] itemsArray = response.getItems();  

 

 

 

分享到:
评论

相关推荐

    manning amazon web services in action 2nd edition

    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(Manning,2015)

    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

    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

    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

    AWS Amazon Web Services Tutorial The Ultimate Beginners Guide 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源...

    QCon 2009 beijing全球企业开发大会ppt:3.Jeff Barr-Amazon Web Services

    亚马逊Web Services实战 演讲主题:亚马逊Web Services实战 演讲嘉宾:Jeff Barr 简介: Jeff Barr是亚马逊(Amazon)的云计算战略师,在该主题中,他将和与会者分享亚马逊企业级Web Services路线图,比如亚马逊...

    Beginning.Amazon.Web.Services.with.Node.js.1484206541

    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

    AWS Amazon Web Services Tutorial The Ultimate Beginners Guide 英文azw3 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除

    Learn Amazon Web Services in a Month of Lunches 无水印原版pdf

    Learn Amazon Web Services in a Month of Lunches 英文无水印原版pdf pdf所有页面使用FoxitReader、PDF-XChangeViewer、SumatraPDF和Firefox测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn...

    Amazon Web services

    prepare for the Amazon Web Services (AWS) Certified SysOps Administrator – Associate exam:

    Amazon Web Services in Action

    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.txt

    Amazon Web Services

    Docker on 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 Services for Mobile

    Amazon官方出版的移动开发Web服务指南,介绍了如何使用AWS服务开发iOS和Android应用程序。

    在Amazon Web Services上实现Microsoft应用程序现代化

    现在,云是大多数企业 IT 战略的核心。许多企业发现,妥善规划的云迁移策略(“简单地搬运”)能够带来直接的业务收益...本白皮书介绍现代化 Amazon Web Services (AWS) 上的应用程序的优势以及如何开始您的这一旅程。

    Amazon+Web+Services概述

    自2006年, Amazon Web Services (简称 AWS)开始以网络服务的形式向企业提供IT基础设施服务—— 这也就是如今广为人知的云计算。核心优势之一,在于其能够取代基础设施带来的前期投入,且可以极低成本根据业务需求...

    Pro PowerShell for Amazon Web Services

    Pro PowerShell for Amazon Web Services Pro PowerShell for Amazon Web Services

Global site tag (gtag.js) - Google Analytics