C U T B H P N

Lecture #26 - Restful Services

Web Resources:

Linux Tutorials eclipse Code Project SysInternals Best SysInternals Tools Dr. Dobb's Journal Windows Forms COM at MSDN IDL Language base MIDL types OLE data types IDL attributes MIDL data types MIDL Language Reference

Content:

In this lecture we discuss services based on REpresentational State Transfer (REST).

  1. Syllabus describes topics to be covered, reading material for you to digest before coming to class, and due dates for the assigned projects.
  2. Final Presentation Schedule
  3. Discussion of the REST model

    Use web methods: GET, POST, PUT, DELETE and don't manage state on the server.

    Urls are used to distinguish content and actions:

    http://host/content
    http://host/action/parameters

    The advantages of REST are: light-weight processing, scalability, and simplicity of server design.

    The disadvantages of REST are: no internal security model, higher network traffic to move all state to clients, and it doesn't wrap its processing in models so developers deal with HTML and Javascript (that may in fact be an advantage).

  4. Web model history:

    Original web model was RESTful - simply serve static pages

    Dynamic Content:

    To make content dynamic we moved away from that model, e.j. Asp.Net and Java Server Pages (JSP). Now pages are constructed on demand using state encapsulated in databases.

    Ajax:

    Asynchronous javascript and xml (Ajax) was the first delivery of content not directly rendered by the browser. In a sense it was the beginning of web services and was RESTful. It uses GET and POST to request an action that usually returns content in the form of a text, XML, or content configured in a Javascript Object Notation (JSON) string.

    Web Services

    Traditional web services grew out of the Ajax model - content that is not intended for human consumption is delivered to a client machine. For Ajax, that was always a browser. But web services extended that to clients running other programs.

    SOAP:

    These web services were based on expanding HTTP by wrapping Simple Object Access Protocol (SOAP) messages inside the HTTP bodies. SOAP supported Remote Procedure Call (RPC) models. They appear to offer functions that can be executed by a remote machine. They use the Web Service Description Language (WSDL) to tell clients how to access their functions. Not RESTful at all.

    Windows Communication Foundation (WCF):

    Several years ago Microsoft released WCF, a remote communication facility that enfolded traditional SOAP-based web services, network communication, and shared memory communication into one programming model.

    WCF supports service hosting in its Internet Information Services (IIS) web server, as Windows services, using Windows Activation Service (WAS), and self hosting in executables.

    Web API

    Google, Amazon, Facebook, and many others have recently provided access to their content in Web APIs (GET, PUT, POST, DELETE) that return JSON. Microsoft released its Web api hosted primarily by Asp.Net in IIS, but that can also be self hosted.

    HTML5:

    HTML5 has several facilities that support RESTful processing:

    Local storage supports maintaining state on the browser client instead of the server.
    New ways of supporting processing on the browser instead of the server: forms functionality, input validation, session history, and geo-location.

  5. Moving toward REST on Windows