<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>I&#039;m Donkey &#187; WebService</title>
	<atom:link href="http://imdonkey.com/blog/archives/tag/webservice/feed" rel="self" type="application/rss+xml" />
	<link>http://imdonkey.com/blog</link>
	<description></description>
	<lastBuildDate>Thu, 26 Aug 2010 02:14:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Java实现Amazon数据抓取(包括Signature生成)</title>
		<link>http://imdonkey.com/blog/archives/60</link>
		<comments>http://imdonkey.com/blog/archives/60#comments</comments>
		<pubDate>Wed, 30 Dec 2009 08:19:11 +0000</pubDate>
		<dc:creator>luoxi</dc:creator>
				<category><![CDATA[坨坨胡同儿]]></category>
		<category><![CDATA[Amazon]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[SOAP]]></category>
		<category><![CDATA[WebService]]></category>

		<guid isPermaLink="false">http://imdonkey.com/blog/?p=60</guid>
		<description><![CDATA[Amazon目前已提供了N多服务，这里只涉及其中的Product Advertising API。通过它，你可以访问Amazon的数据库，实现很多有用的功能，如：获取商品信息、买家/卖家的评论、还可以搜索物品、促销信息等，这些数据有助于建立你自己的电子商务网站。

下面简单讲述一下用Java语言访问Product Advertising API，并写了两个<span style="color: #0000ff;">搜索物品</span>和<span style="color: #0000ff;">浏览目录</span>的例子。

相关链接：
<a href="http://docs.amazonwebservices.com/AWSECommerceService/2009-10-01/DG/">Product Advertising API
</a><a href="http://code.google.com/p/amazon-product-advertising-api-sample/">amazon-product-advertising-api-sample</a><p class='read-more'><a href='http://imdonkey.com/blog/archives/60'>阅读全文 »</a></p>]]></description>
			<content:encoded><![CDATA[<p>Amazon目前已提供了N多服务，这里只涉及其中的Product Advertising API。通过它，你可以访问Amazon的数据库，实现很多有用的功能，如：获取商品信息、买家/卖家的评论、还可以搜索物品、促销信息等，这些数据有助于建立你自己的电子商务网站。</p>
<p>下面简单讲述一下用Java语言访问Product Advertising API</p>
<p>首先，你要先去 http://aws.amazon.com 注册自己的账号，注册后记住系统生成的Access Key ID和     Secret Access Key，这两个key值在代码中会用到。这时你可以到<a class="ulink" href="http://associates-amazon.s3.amazonaws.com/signed-requests/helper/index.html" target="_blank">Product Advertising API Signed Requests Helper</a>测试一下这两个Key是否可用，顺便也能了解了解Amazon设定的request和response结构。</p>
<p>然后下载Product Advertising API Java Client                 Side Library（<span style="color: #008000;">需要Java6</span>），这个lib可以简化开发。下载步骤：</p>
<blockquote>
<ol type="1">
<li>
<p class="simpara">Go to the directory where you want to generate the stubs and create a                           &#8220;build&#8221; directory and a &#8220;src&#8221; directory.</p>
<p class="simpara">All of the generated source code will go under &#8220;src&#8221; folder.</p>
</li>
<li>
<p class="simpara">If you are using Eclipse 3.2, create a custom binding to disable                         &#8220;Wrapper Style&#8221; code generation.</p>
<pre style="overflow: auto; background: #ffffff;">&lt;jaxws:bindings wsdlLocation="http://ecs.amazonaws.com/AWSECommerceService/AWSECommerceService.wsdl" xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"&gt;
  &lt;jaxws:enableWrapperStyle&gt;false&lt;/jaxws:enableWrapperStyle&gt;
&lt;/jaxws:bindings&gt;</pre>
<p class="simpara">This step is necessary because Eclipse 3.2 does not support wrapper                             style generated code. However, if you are an IDE that does support                             wrapper style generated code, such as NetBeans, this step is not                             required.</p>
</li>
<li>
<p class="simpara">Run the command:</p>
<pre style="overflow: auto; background: #ffffff;">wsimport -d ./build -s ./src  -p com.ECS.client.jax http://ecs.amazonaws.com/AWSECommerceService/AWSECommerceService.wsdl -b jaxws-custom.xml .</pre>
<p class="simpara">You can find the generated stubs in the path,                             <em>com.ECS.client.jax</em> .</p>
</li>
</ol>
</blockquote>
<p>由于2009年8月后，Amazon升级了WebService，对request添加了更为严格的安全机制——Signature，所以还需要下载两个辅助文件：</p>
<tr>
<td width="1%"><a href="http://developer.amazonwebservices.com/connect/servlet/JiveServlet/download/53-35999-143146-2680/awshandlerresolver.java"><img src="http://developer.amazonwebservices.com/connect/servlet/JiveServlet?attachImage=true&amp;contentType=application%2Foctet-stream&amp;attachment=2680" border="0" alt="Attachment" /></a></td>
<td class="jive-description" width="98%"><a href="http://developer.amazonwebservices.com/connect/servlet/JiveServlet/download/53-35999-143146-2680/awshandlerresolver.java">awshandlerresolver.java</a> (4.2 K)</td>
</tr>
<tr>
<td width="1%"><a href="http://developer.amazonwebservices.com/connect/servlet/JiveServlet/download/53-35999-143146-2681/commons-codec-1.3.jar"><img src="http://developer.amazonwebservices.com/connect/servlet/JiveServlet?attachImage=true&amp;contentType=application%2Foctet-stream&amp;attachment=2681" border="0" alt="Attachment" /></a></td>
<td class="jive-description" width="98%"><a href="http://developer.amazonwebservices.com/connect/servlet/JiveServlet/download/53-35999-143146-2681/commons-codec-1.3.jar">commons-codec-1.3.jar</a> (45.6 K)</td>
</tr>
<p>接下来，就可以写demo了，记得import刚刚下载的开发包和辅助代码。</p>
<p><strong>DEMO1</strong>. 先写个Search的例子，搜索ASIN为0596007124的物品</p>
<p>示例代码如下：</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #006699; font-weight: bold;">public</span> <span style="color: #006699; font-weight: bold;">class</span> Info <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #006699; font-weight: bold;">public</span> <span style="color: #006699; font-weight: bold;">static</span> <span style="color: #006699; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #006699; font-weight: bold;">new</span> Info<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #006699; font-weight: bold;">public</span> Info<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #008200;">// Initialize Web Service</span>
		AWSECommerceService service <span style="color: #339933;">=</span> <span style="color: #006699; font-weight: bold;">new</span> AWSECommerceService<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		service.<span style="color: #006633;">setHandlerResolver</span><span style="color: #009900;">&#40;</span><span style="color: #006699; font-weight: bold;">new</span> AwsHandlerResolver<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;Your Secret Key&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #008200;">// Create Web Service Connection</span>
		AWSECommerceServicePortType port <span style="color: #339933;">=</span> service.<span style="color: #006633;">getAWSECommerceServicePort</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #008200;">// Add Parameters for the Item Lookup</span>
		ItemLookupRequest request <span style="color: #339933;">=</span> <span style="color: #006699; font-weight: bold;">new</span> ItemLookupRequest<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		request.<span style="color: #006633;">getItemId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;0596007124&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		request.<span style="color: #006633;">setIdType</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;ASIN&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		request.<span style="color: #006633;">getResponseGroup</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Large&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #008200;">// Wrap Request in Lookup Body</span>
		ItemLookup body <span style="color: #339933;">=</span> <span style="color: #006699; font-weight: bold;">new</span> ItemLookup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		body.<span style="color: #006633;">setAWSAccessKeyId</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;Your Access ID&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		body.<span style="color: #006633;">setShared</span><span style="color: #009900;">&#40;</span>request<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #008200;">// Assign Results to a Response Object</span>
		ItemLookupResponse response <span style="color: #339933;">=</span> port.<span style="color: #006633;">itemLookup</span><span style="color: #009900;">&#40;</span>body<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		Item item <span style="color: #339933;">=</span> response.<span style="color: #006633;">getItems</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getItem</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>上面的例子中ResponseGroup只添加了“Large”，意思是返回结果中包括物品的大图，除此以外，你还可以添加更多的返回信息，如：BrowseNodes，EditorialReview，ItemAttributes等。</p>
<p><strong>DEMO2</strong>. 抓取Amazon某个目录下的所有物品。这种抓取需要知道要抓的目录id号，即nodeid，这个可以通过分析Amazon的url获得。<br />
比如：<strong><a style="font-family: verdana, arial, helvetica, sans-serif; color: #003399; text-decoration: none;" href="http://www.amazon.com/s/qid=1262157503/ref=sr_hi?ie=UTF8&amp;rs=1058&amp;bbn=&amp;rh=i%3Astripbooks&amp;page=1">Books</a> <span style="color: #666666; font-weight: normal;">›</span> <a style="font-family: verdana, arial, helvetica, sans-serif; color: #003399; text-decoration: none;" href="http://www.amazon.com/s/qid=1262157503/ref=sr_hi?ie=UTF8&amp;rs=1058&amp;bbn=173507&amp;rh=i%3Astripbooks%2Cn%3A%211000%2Cn%3A173507&amp;page=1">Professional &amp; Technical</a> <span style="color: #666666; font-weight: normal;">›</span> <a style="font-family: verdana, arial, helvetica, sans-serif; color: #003399; text-decoration: none;" href="http://www.amazon.com/s/qid=1262157503/ref=sr_hi?ie=UTF8&amp;rs=1058&amp;bbn=173508&amp;rh=i%3Astripbooks%2Cn%3A%211000%2Cn%3A173507%2Cn%3A173508&amp;page=1">Architecture</a> <span style="color: #666666; font-weight: normal;">›</span> Materials <span style="color: #000000; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-weight: normal; line-height: 19px;">这个目录，它的url是</span></strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<pre style="overflow: auto; background: #ffffff;"><a href="http://www.amazon.com/gp/search/ref=sr_nr_n_10?rh=i:stripbooks,n:!1000,n:173507,n:173508,n:1058&amp;bbn=173508&amp;ie=UTF8&amp;qid=1262157489&amp;rnid=173508">http://www.amazon.com/gp/search/ref=sr_nr_n_10?rh=i:stripbooks,n:!1000,n:173507,n:173508,n:1058&amp;bbn=173508&amp;ie=UTF8&amp;qid=1262157489&amp;rnid=173508</a></pre>
<p>，它的nodeid就是1058</p>
<p><strong><span style="color: #000000; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-weight: normal; line-height: 19px;">示例代码如下：</span></strong></p>
<p><strong><span style="color: #000000; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-weight: normal; line-height: 19px;"> </span></strong></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #006699; font-weight: bold;">public</span> <span style="color: #006699; font-weight: bold;">class</span> InfoScrap <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #006699; font-weight: bold;">public</span> <span style="color: #006699; font-weight: bold;">static</span> <span style="color: #006699; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #006699; font-weight: bold;">new</span> InfoScrap<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #006699; font-weight: bold;">public</span> InfoScrap<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #008200;">// Initialize Web Service</span>
		AWSECommerceService service <span style="color: #339933;">=</span> <span style="color: #006699; font-weight: bold;">new</span> AWSECommerceService<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		service.<span style="color: #006633;">setHandlerResolver</span><span style="color: #009900;">&#40;</span><span style="color: #006699; font-weight: bold;">new</span> AwsHandlerResolver<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;Your Secret Key&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #008200;">// Create Web Service Connection</span>
		AWSECommerceServicePortType port <span style="color: #339933;">=</span> service.<span style="color: #006633;">getAWSECommerceServicePort</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #008200;">// Add Parameters for the Item Search</span>
		ItemSearchRequest request <span style="color: #339933;">=</span> <span style="color: #006699; font-weight: bold;">new</span> ItemSearchRequest<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		java.<span style="color: #006633;">util</span>.<span style="color: #006633;">List</span><span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;</span> attrs <span style="color: #339933;">=</span> <span style="color: #006699; font-weight: bold;">new</span> ArrayList<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		attrs.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Request&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		attrs.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;BrowseNodes&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		attrs.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;EditorialReview&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		attrs.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;ItemAttributes&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		attrs.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Large&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		request.<span style="color: #006633;">getResponseGroup</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">addAll</span><span style="color: #009900;">&#40;</span>attrs<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		request.<span style="color: #006633;">setBrowseNode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;1058&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		request.<span style="color: #006633;">setSearchIndex</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Books&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #008200;">// Only search Book</span>
&nbsp;
		<span style="color: #008200;">// Get browse node page count</span>
		<span style="color: #006699; font-weight: bold;">int</span> page <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
&nbsp;
		ItemSearch itemSearch <span style="color: #339933;">=</span> <span style="color: #006699; font-weight: bold;">new</span> ItemSearch<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		itemSearch.<span style="color: #006633;">setAWSAccessKeyId</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;Your Access ID&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		itemSearch.<span style="color: #006633;">getRequest</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>request<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		ItemSearchResponse response <span style="color: #339933;">=</span> port.<span style="color: #006633;">itemSearch</span><span style="color: #009900;">&#40;</span>itemSearch<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		java.<span style="color: #006633;">util</span>.<span style="color: #006633;">List</span><span style="color: #339933;">&lt;</span>Items<span style="color: #339933;">&gt;</span> itemssList <span style="color: #339933;">=</span> response.<span style="color: #006633;">getItems</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #006699; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>Items items <span style="color: #339933;">:</span> itemssList<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			page <span style="color: #339933;">=</span> items.<span style="color: #006633;">getTotalPages</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">intValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #008200;">// Start Scrapping Items per page</span>
		<span style="color: #006699; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #006699; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> page<span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			request.<span style="color: #006633;">setItemPage</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">BigInteger</span>.<span style="color: #006633;">valueOf</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			port <span style="color: #339933;">=</span> service.<span style="color: #006633;">getAWSECommerceServicePort</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			itemSearch <span style="color: #339933;">=</span> <span style="color: #006699; font-weight: bold;">new</span> ItemSearch<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			itemSearch.<span style="color: #006633;">setAWSAccessKeyId</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;Your Access ID&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			itemSearch.<span style="color: #006633;">getRequest</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>request<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			response <span style="color: #339933;">=</span> port.<span style="color: #006633;">itemSearch</span><span style="color: #009900;">&#40;</span>itemSearch<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			itemssList <span style="color: #339933;">=</span> response.<span style="color: #006633;">getItems</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #006699; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>Items items <span style="color: #339933;">:</span> itemssList<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				java.<span style="color: #006633;">util</span>.<span style="color: #006633;">List</span><span style="color: #339933;">&lt;</span>Item<span style="color: #339933;">&gt;</span> itemsList <span style="color: #339933;">=</span> items.<span style="color: #006633;">getItem</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #006699; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>Item item <span style="color: #339933;">:</span> itemsList<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					<span style="color: #008200;">// callback(item);</span>
					<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Complete &quot;</span> <span style="color: #339933;">+</span> i <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;/&quot;</span> <span style="color: #339933;">+</span> page<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><span style="white-space: pre;"> </span>相关链接：<span style="color: #000000;"><br />
<a href="http://docs.amazonwebservices.com/AWSECommerceService/2009-10-01/DG/"> Product Advertising API<br />
<span style="color: #000000; -webkit-text-decorations-in-effect: none;"><span style="text-decoration: underline;"> </span></span></a><a href="http://code.google.com/p/amazon-product-advertising-api-sample/">amazon-product-advertising-api-sample</a></span></p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">http://docs.amazonwebservices.com/AWSECommerceService/2009-10-01/GSG/index.html?ImplementinganA2SRequest.html</div>
]]></content:encoded>
			<wfw:commentRss>http://imdonkey.com/blog/archives/60/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
