<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="http://www.majordojo.com/projects/FeedManager/atom.xsl" type="text/xsl" media="screen"?>
<feed xmlns="http://www.w3.org/2005/Atom" 
      xmlns:thr="http://purl.org/syndication/thread/1.0">
  <link rel="alternate" type="text/html" href="http://www.majordojo.com/2003/08/amazon-query.php" />
  <link rel="self" type="application/atom+xml" href="http://www.majordojo.com/2003/08/amazon-query.php" />
  <id>tag:www.majordojo.com,2010://3/tag:www.majordojo.com,2003://3.2210-</id>
  <updated></updated>
  <title>Comments for Amazon Query</title>
  <subtitle>A blog about Movable Type, technology, geek-dom, science-fiction and yes, sometimes my personal life.</subtitle>
  <generator uri="http://www.sixapart.com/movabletype/">Movable Type 4.261</generator>
  <entry>
    <id>tag:www.majordojo.com,2003://3.2210</id>
    <link rel="alternate" type="text/html" href="http://www.majordojo.com/2003/08/amazon-query.php" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.majordojo.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=3/entry_id=2210" title="Amazon Query" />
    <published>2003-08-11T06:33:45Z</published>
    <updated>2007-02-11T07:39:49Z</updated>
    <title>Amazon Query</title>
    <summary>To be fair, Amazon does have their own native SOAP interface which most likely is a better option than this gateway. Please visit Amazon.com Web Services Homepage for more details. However, as an example on how to implement a Web...</summary>
    <author>
      <name>Byrne</name>
      <uri>http://www.majordojo.com/</uri>
    </author>
    
    <category term="Personal Projects" />
    
    <content type="html" xml:lang="en" xml:base="http://www.majordojo.com/">
      <![CDATA[<p><b>To be fair, Amazon does have their own native SOAP interface which most likely is a better option than this gateway. Please visit <a href="http://associates.amazon.com/exec/panama/associates/join/developer/resources.html/102-0816923-1348124">Amazon.com Web Services Homepage</a> for more details.</b> However, as an example on how to implement a Web service using SOAP::Lite, this might be just what you are looking for!</p>
]]>
      <![CDATA[<p>Amazon.com makes its product listings available through a REST interface. REST is an XML query protocol built entirely upon the HTTP request-response model. It uses query strings to pass arguments to the XML service. While I have no issues with a REST interface, I personally find it easier to use standard SOAP toolkits like SOAP::Lite to query Web services. These SOAP toolkits typically have XML parsing built-in, which makes it a little easier (IMHO) to traverse the response from the service.</p>

<p>That is why I built a SOAP gateway service to Amazon's REST interface. It is actually a very simple service (<a href="amazon_query/amazon_query.txt">download</a> the source below). All it does it unwrap a SOAP request with parameters passed in through the SOAP Body, compose an HTTP request with the corresponding URL, and return the response in a SOAP Envelope.</p>

<p>This service is available through the <a href="http://www.gnu.org/licenses/gpl.txt">GNU Public License</a>.</p>  

<h2>Resources</h2>
<ul>
<li><a href="http://soaplite.com/">SOAP::Lite Home</a></li>
<li><a href="http://forums.prospero.com/am-assocdevxml">Amazon Developer Forum</a></li>

<li><a href="http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm">REST</a></li>
<li><a href="http://www.xmethods.com/">Xmethods</a> - <a href="http://www.xmethods.net/ve2/ViewListing.po?serviceid=84114">Listing</a></li>
</ul>

<h2>Source</h2>

<p>
<li><a href="amazon_query/amazon_query.txt">Web Service</a></li>
<li><a href="amazon_query/amazon_query_mime.txt">Web Service (MIME variant)</a> - this one returns the results in a MIME attachment</li>
<li><a href="amazon_query/amazon_query.wsdl">WSDL</a></li>
<li><a href="amazon_query/client.php">SOAP::Lite client (example)</a></li>
</p>

<h2>Examples</h2>

<p><b>Example Search Request</b>:<br>

<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;SOAP-ENV:Envelope 
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
    SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/1999/XMLSchema"&gt;
  &lt;SOAP-ENV:Body&gt;
    &lt;namesp1:query xmlns:namesp1="urn:AmazonQuery"&gt;
      &lt;associates_id xsi:type="xsd:string"&gt;majordojo-20&lt;/associates_id&gt;
      &lt;product_group xsi:type="xsd:string"&gt;books&lt;/product&gt;

      &lt;keywords xsi:type="xsd:string"&gt;bar&lt;/keywords&gt;
    &lt;/namesp1:query&gt;
  &lt;/SOAP-ENV:Body&gt;
&lt;/SOAP-ENV:Envelope&gt;</pre>
</p>

<p><b>Example Browse Request</b>:<br>

<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;SOAP-ENV:Envelope 
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
    SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/1999/XMLSchema"&gt;
  &lt;SOAP-ENV:Body&gt;
    &lt;namesp1:query xmlns:namesp1="urn:AmazonQuery"&gt;
      &lt;associates_id xsi:type="xsd:string"&gt;majordojo-20&lt;/associates_id&gt;
      &lt;product_group xsi:type="xsd:string"&gt;books&lt;/product&gt;

      &lt;category xsi:type="xsd:string"&gt;foo&lt;/category&gt;
    &lt;/namesp1:query&gt;
  &lt;/SOAP-ENV:Body&gt;
&lt;/SOAP-ENV:Envelope&gt;</pre></p>
]]>
    </content>
  </entry>

</feed>
