Chapter 4. Building Web Services with ReST

In This Chapter

  • Understanding the principles of ReST

  • Implementing ReST services using WCF

  • Consuming ReST services

Chapter 3 includes a sidebar, "Using Different Endpoints," that has a big list of binding formats you can use with WCF. I point out that for most applications, you use SOAP, or binary. That's not necessarily accurate.

Another binding is pretty popular — it is the binding that your Web browser uses to get pages from Web servers. It is called ReST, and it stands for Representational State Transfer.

In this chapter, I introduce you to ReST and guide you through its advantages and drawbacks.

Getting to Know ReST

ReST is basically the use of the traditional GET and POST patterns the old folks will remember from CGI. For you young pups, it is the basic format of Web requests. For instance, when you click on a link that looks like this:

http://mydomain.com/start.aspx?id=3

. . . you are using ReST. Remember, we aren't talking about an implementation here. We are talking about a remote procedure call mechanism. It is just a way to get parameters for a query to a remote machine and to get data back.

We also aren't talking about a protocol, like SOAP is. ReST is an architecture. It has guidelines, not rules.

A ReST interface has four goals. They are

  • Scalability of component interactions

  • Generality of interfaces

  • Independent deployment of components

  • Intermediary components to reduce latency, enforce security, and encapsulate legacy systems

Use of ReST with ...

Get C# 2010 All-in-One For Dummies® 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.