O'Reilly logo

Data-Driven Services with Silverlight 2 by John Papa

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required