Creating an Amazon Shopping Cart

The previous chapters demonstrated the basic concepts of communicating with a RESTful remote web service using WebClient and HttpWebRequest, using LINQ to XML to consume a response, conquering cross-domain policies, and creating rich data-bound applications. Although it is great to talk about what RESTful services are and how to consume them, the power behind opening applications to these services is more obvious when you can see it demonstrated in an example with an existing RESTful API. In this chapter, we’ll do just that with Amazon’s E-Commerce Services (Amazon ECS). The example will show you how many of the capabilities we’ve discussed work together in a real application that allows a user to search the Amazon book database, create a shopping cart stored at Amazon, add and remove items from the cart, accumulate an order total, and begin the checkout process, all from a Silverlight 2 client application.

The architecture of this example involves a few moving parts. First the Silverlight 2 application provides the interface for the user and the communication between the user interface and the shopping services at Amazon. The Amazon E-Commerce Service has a RESTful API that makes it easy to plug into the Amazon product database. This example will focus on shopping for books at Amazon to keep the example focused; however, it is possible to do much more with the API. The Silverlight 2 client application will use the WebClient library to communicate ...

Get Data-Driven Services with Silverlight 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.