Chapter 2. WCF RESTful Programming Model
In Chapter 1, I introduced the concepts fundamental to using REST to build services. WCF in .NET 3.5 includes a sophisticated built-in mechanism that allows you, a .NET developer, to build RESTful services using the WCF programming model.
Isn’t WCF All About SOAP?
You might be thinking, “Isn’t WCF all about SOAP?” While you will probably find many people who think WCF is only used for building SOAP-based services (and many who think WCF is only for building RPC-styled SOAP-based services), it turns out that WCF is much broader than either of those communication styles. WCF is really a highly extensible framework with a common programming model and a totally pluggable communication infrastructure.
To illustrate the high-level extensibility of WCF, let’s look at some technical details on particular pieces of WCF’s plumbing. Although most of the time you won’t be working at this low level, looking at this code will help your understanding of REST and WCF.
Channels and Dispatching
So what does WCF do, from a server-side perspective? The basic job of the WCF runtime is to listen for (or retrieve) messages from a network location, process those messages, and pass them to your code so that your code can implement the functionality of a service (Figure 2-1).
WCF’s client-side programming model is symmetrical to that on the server side, but the processing of messages is in the opposite direction. Chapter 10 discusses the WCF programming model from the ...