PDC 2008 Experience: Day 4: Session = "WCF: Building RESTful Services"
WCF (Referred to as DUB CF).
Content Driven Web Architecture
- The Browser
- Generic client experience
- URI's
- Addressing and identification
- HTML
- Common presentation formal
- Hyperlinks
- Anarchic interconnectivity
- HTTP GET
- Ubiquitous operation for retrieval (the should be now side effects of a GET)
Capability Enabled Web Architecture
- Rich Browser Clients
- Programmability via script or plugins
- HTTP
- Baseline application protocol
- Common set of operations + status codes
- Domain-neutral data-oriented formats
- XML
- JSON
- Atom/Atom publishing
- Refine to support domain-specific schemas
- Presentation formats
RESTful Tenants
- The Web is a graph of linked resources
- Resources are identified by URI's
- Resources support a fixed set of operations
- In practice, these are defined by HTTP
- Application follow links to achieve late binds
REST is an architecture style*, not a specification
* see Fielding: http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm
[WebGet] and [WebInvoke]
- Binds a WCF operation to URI space and HTTP method
- Indicate the HTTP Method for the operation
- WebGet - Don't make me write it
- WebInvoke
UriTemplate
- String that allows you to define the structure of the URI, as well as to define "Holes"
- The "Holes" are variables
- You bind the template with parameters to fill the holes
1: [OperationContract]
2: [WebGet(UriTemplate="product/{productId]")]
3: Product GetProducts(string productId)
webHttpBinding
- New "web-friendly WCF Binging in Fx 3.5
- Allows for the development of RESTful
WebServiceHost
- SepcializedServiceHost for RESTful services
- Eliminates need for lots of configuration
- Automatically configures address, binding, contract
- Optimized fro single end-point services
WCF REST Starter Kit
Available for download at http://msdn.com/wcf/rest
- Extensive REST Samples
- Visual Studio Templates
- REST Collection / Singleton Services
- Atom Feed / Atom Publishing Protocol
- HTTP/ POX services
- Microsoft.ServiceModel.Web.dll
- Preview of additional framework features
- Binary included in Starter Kit
- Buildable source available on CodePlex
- RESTful meta data
Resources