Chapter 4. Programming Read/Write Services
In the previous chapter, you were introduced to the WCF 3.5 web programming model and the major pieces of its infrastructure. You used the programming model to write a read-only RESTful service, and used the infrastructure to deploy and expose it.
While it could be that some of the services you build will be
read-only, it is more likely that your services will include other parts of
the uniform interface in addition to GET. In this
chapter, I’ll show you how to put the WCF 3.5 web programming model to work
in building a read/write service that allows user agents to create, modify,
and delete resources.
POST, PUT, and DELETE
Chapter 1 discussed REST and the architectural constraints of the uniform interface. See Figure 4-1 to refresh your memory about the uniform interface and how it should work.

Recall from Chapter 3 that
WCF enables a RESTful programming model by allowing annotation on methods
via attributes. These attributes specify which method should be invoked
for each URI, and which part of the uniform interface each method
implements. For example, WebGetAttribute will implement
GET, and its UriTemplate property
value specifies the URI to which the method will respond.
All other verbs in the uniform interface (POST,
PUT, and DELETE) are implemented
using the WebInvokeAttribute.
WebInvokeAttribute also allows ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access