Chapter 9. Creating RESTful Services and Introducing SilverTwit

The preceding chapter showed how you can take advantage of the RESTful services exposed by the Amazon web services API to create a robust Silverlight 2 client that allows a user to search through and shop on Amazon.com. The case study demonstrated how to request data using the HTTP GET method, but of course there are ways to submit data using HTTP through POST, PUT, DELETE, and other HTTP methods, as well. This chapter will expand on these topics by demonstrating how to build custom REST web services using Windows Communication Foundation (WCF), support HTTP actions, customize URI templates, and return data as either XML or JSON.

When you are designing web services to expose functionality and resources to client applications, in many cases RESTful web services are a good alternative to using SOAP-based web services. You can build custom RESTful services in a variety of ways; however, WCF provides a lot of the plumbing that you need to create RESTful services out of the box. This chapter shows how to build custom RESTful services using WCF that send and receive requests and responses. The chapter also demonstrates various HTTP methods, and shows how to implement status codes and define URI templates.

You can design a RESTful service to return data in different formats. Two common data formats are XML and JSON. This chapter demonstrates how to design services that send responses as JSON or XML, and shows how to consume ...

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.