Presentation is loading. Please wait.

Presentation is loading. Please wait.

WCF 3.5, REST ET AL. H OW TO ? Adnan Masood

Similar presentations

Presentation on theme: "WCF 3.5, REST ET AL. H OW TO ? Adnan Masood"— Presentation transcript:

1 WCF 3.5, REST ET AL. H OW TO ? Adnan Masood

2 A BOUT M E AKA. S HAMELESS S ELF P ROMOTION Sr. Software Engineer / Tech Lead for Green Dot Corp. (Financial Institution) Design and Develop Connected Systems Involved with SoCal Dev community, co-founded San Gabriel Valley.NET Developers Group. Published author and speaker. MS. Computer Science, MCPD (Enterprise Developer), MCT, MCSD.NET Doctoral Student - Areas of Interest: Machine learning, Bayesian Inference, Data Mining, Collaborative Filtering, Recommender Systems. Contact at Read my Blog at Doing a session in IASA 2008 in San Francisco on Aspect Oriented Programming; for details visit

3 A GENDA Overview of SOA, Web Services, Design Patterns Whats new in WCF 3.5 Discuss what is REST? How to Implement REST using WCF? What are UriTemplates? How to use them in.NET 3.5?

4 A RCHITECT IQ T EST What are the four tenants of SOA?

5 T ENANTS OF SOA 1. Boundaries are explicit 2. Services are Autonomous 3. Services share Schema and Contract, not Class 4. Compatibility is based upon Policy

6 A BBR./A CRONYMS 101 REST SOAP JSON POX RSS ATOM Representational State Transfer Simple Object Access Protocol Javascript Object Notation Plain Old XML Really Simple Syndication

7 W HAT IS REST? REST is a term coined by Roy Fielding in his Ph.D dissertation [1] to describe an architecture style of networked systems. [1]

8 REST Representational State Transfer There are REST-Services and REST-like services which use XML and HTTP but not the underlying philosophy of REST REST outlines the philosophy of mapping HTTP verbs to the Create/Retrieve/Update/Delete philosophy of APIs as d iscussed in a PhD thesis by Roy Fielding

9{user} (one for each user){location} (one for each location) Examples

10 WCF S UPPORT TO REST WebHttpBinding: Sends information directly over HTTP or HTTPSno SOAP envelope is created. This binding is new with the.NET Framework 3.5 version of WCF, and its the right choice for RESTful communication and other situations where SOAP isnt required. The binding offers three options for representing content: text-based XML encoding, JavaScript Object Notation (JSON) encoding, and opaque binary encoding.

11 R EPRESENTATION S TATE T RANSFER IS THE IDEA BEHIND RESOURCE ORIENTED ARCHITECTURE Resource Client{year}/{month}/{day} Posts 01012008 – a view and not a physical file The Client references a Web resource using a URL. A representation of the resource is returned which can be rendered as an HTML. Blog Posts for the day

12 M OTIVATION FOR REST "The motivation for developing REST was to create an architectural model for how the Web should work, such that it could serve as the guiding framework for the Web protocol standards. REST has been applied to describe the desired Web architecture, help identify existing problems, compare alternative solutions, and ensure that protocol extensions would not violate the core constraints that make the Web successful." - Roy Fielding

13 REST VS. SOAP – Enhanced Caching – Invocation vs. Resource – Bloat vs. Simplicity – Proxy Servers – Web evolution (semantic Web) – Generic Uri based interface via UriTemplates (versus custom SOAP interface) – Interoperability

14 RESTF UL ARCHITECTURE B EST P RACTICES * 1.Prefer HTTP-GET over POST when a information resource URI is exposed. 2.Publish a logical URI for every programmable resource being exposed in the service. 3.Logical URI are preferred over the physical URL. The logical URL (such as : is better than physical URI. ( 4.Create and Follow URI Template rules; this way logical URIs can modify the implementation without impacting client applications. 5.REST services focus on representing resources as "things" and not "actions". The REST Uris are the nouns, not verbs. *Roger L. Costello XML technologies course also discusses some of these points.

15 RESTF UL ARCHITECTURE B EST P RACTICES ( CONT.) 6. Design functional oriented read methods i.e. the GET methods should be side-effect free. 7. Use the extended information links in the responses to allow the consuming application to follow the next steps if further actions are needed. 8. As a corollary to item 6, use the extended information links for workflow actions to allow the atomic unfolding based on the current state. 9. Meaningful Uri templates are more effective than Query strings; for instance is more appropriate REST pattern than 10. The URL delimiter / should be used to represent the inheritance or part of relationship in the logical hierarchy. For instance{year}/{month}/{day}/ is more effective than{day}/{month}/{year}.{year}/{month}/{day}/{day}/{month}/{year}


17 HTTP Programming with WCF and the.NET Framework 3.5 - Justin Smith efault.aspx efault.aspx What's New for WCF in Visual Studio 2008 – Juval Lowy efault.aspx efault.aspx RESTful Web Services By Leonard Richardson, Sam Ruby Richardson/dp/0596529260 Richardson/dp/0596529260 Mix 2007 Talk by Don Box and Steve Maine DEV03 - Navigating the Programmable Web 12&pid=DEV03&disc=&id=1512&year=2007&search=DEV03 12&pid=DEV03&disc=&id=1512&year=2007&search=DEV03 R EFERENCES

18 Paul Prescod has written several excellent articles on REST: – Second Generation Web Services – REST and the Real World – SOAP, REST and Interoperability – Evaluating XML for Protocol Control Data Wikipedia Entry on REST Publishing RSS and ATOM Feeds using WCF 3.5 Syndication Libraries Exploring WCF 3.5 Tools - WcfSvcHost and WcfTestClient Web Service Studio JSON

19 C ONCLUDING R EMARKS REST is a new paradigm for.NET Developers; a new way to think about programming web services but its not really new since we have been using it for a long time over the web. Any Questions / Comments … feel free to contact Visit

Download ppt "WCF 3.5, REST ET AL. H OW TO ? Adnan Masood"

Similar presentations

Ads by Google