Generating RSS with XSLT and Amazon ECS
One choice you have to make when working with web services is how you will process the web service response. You could build the processing into a rich client, but that would likely require some type of installation for others to use your application. You could process the web service response on a server, but that requires, well, a server. Amazon ECS has an alternate solution: the XSLT service.
XSLT is a language for transforming XML into other formats. The XSLT service with Amazon ECS can transform a REST response using an XSLT file you identify by adding a parameter that specifies the location of the file and returning the transformed result. This means that a call to the Amazon ECS web service can return HTML, text, or any other format you want and makes it a compelling alternative to building a rich-client or server-based solution.
In this article we'll walk through the steps for generating an RSS feed for Amazon Wish Lists using Amazon ECS and the XSLT service. We're assuming you have some experience with XSLT, but the Additional Resources section has some links for learning more about the technologies we're using. There's also a complete XSLT file that you can download for your own use.
Finding a Wish List ID
The manual way to find your Wish List ID is to grab it off of the retail web site. For example, the URL for Brian's Wish List is:
In this case, the Wish List ID is 30BOZ74K6RSKJ.
The more programmatic way to get a Wish List ID is to use the ListSearch operation and search for lists associated with a specific e-mail address or name. For example, this request searches for a Wish List:
http://ecs.amazonaws.com/onca/xml? Service=AWSECommerceService& Version=2006-06-28& AWSAccessKeyId=0525E2PQ81DD7ZTWTK82& Operation=ListSearch& ListType=WishList& Emailemail@example.com
Starting with an Amazon ECS Request
To create a RSS feed for Wish Lists, let's first start out with a basic request to the Amazon ECS REST interface that returns information about a Wish List. (The fact that it's one of the author's Wish Lists is completely random.)
http://webservices.amazon.com/onca/xml? Service=AWSECommerceService& Version=2006-06-07& AWSAccessKeyId=1CE7SK4ZPTNDQZCWBP82& Operation=ListLookup& ListType=WishList& ListId=30BOZ74K6RSKJ& Sort=DateAdded& ResponseGroup=ItemAttributes,ListItems,ListInfo,Offers
This request returns information about each item on the Wish List. This is a snippet of the information we'll transform with our XSLT file:
<ListLookupResponse< <Lists> <List> <ListURL>http://www.amazon.com/...</ListURL> <CustomerName>Brian Swan</CustomerName> <ListItem> <QuantityDesired>1</QuantityDesired> <QuantityReceived>0</QuantityReceived> <Item> <DetailPageURL>http://www.amazon.com/...</DetailPageURL> <ItemAttributes> <Title>Product Name</Title> </ItemAttributes> <OfferSummary> <LowestNewPrice> <FormattedPrice>$9.99</FormattedPrice> </LowestNewPrice> </OfferSummary> </Item> </ListItem> </List> </Lists> </ListLookupResponse>
Pages: 1, 2