Web Services




       Web Service API : 80

         (Legacy) System
Web Services




       Web Service API : 80

         (Legacy) System
The Types of Web Services
Big Web Services
  WS-Notification
                   REST
  WS-Security
                   RPC style
  WSDL
                   REST-RPC hybrid
  SOAP
REST
RESTful Web Services
Representational State Transfer (REST) is a
    style of software architecture for
distributed hypermedia systems such as the
World Wide Web. The term Representational
    State Transfer was introduced and
    defined in 2000 by Roy Fielding in his
 doctoral dissertation. Fielding is one of
  the principal authors of the Hypertext
  Transfer Protocol (HTTP) specification
              versions 1.0 and 1.1.
Bookings

Application   HTTP    Routes

                     Passengers
Resources


                      Bookings

Application   HTTP    Routes

                     Passengers
Resources


                POST    /booking/{id}/
                 GET
Application              /route/{id}/
                 PUT
              DELETE   /passenger/{id}/
Addressable
                        Resources


                POST    /booking/{id}/
                 GET
Application              /route/{id}/
                 PUT
              DELETE   /passenger/{id}/
Uniform    Addressable
              Interface    Resources


                 POST      /booking/{id}/
                  GET
Application                 /route/{id}/
                  PUT
               DELETE     /passenger/{id}/
Addressable
                                   Resources

              GET /booking/123/
                                   /booking/{id}/

Application                         /route/{id}/

                                  /passenger/{id}/
Addressable
                                    Resources

              GET /booking/123/
                                   /booking/{id}/

Application                         /route/{id}/

                                  /passenger/{id}/

                                    State and
                                  Representation
Addressable
                                             Resources

                       GET /booking/123/
                                            /booking/{id}/

Application                                  /route/{id}/
                            200 OK
                                           /passenger/{id}/
  id: 123,
  pickupTime: ‘2010-12-13T09:00:00’,
  passenger: {                               State and
     link: {
        href: ‘/passenger/234’,            Representation
        rel: ‘related’
     }
  }
REST = HTTP Used Right

REST was “developed” in parallel with the HTTP/1.1
protocol
Caching and conditional GET
Proxies
HTTP headers (e.g.content negotiation)
HTTP methods
Everything Is a Resource




    There shall be nothing else
Everything Is a Resource



         ROA
    There shall be nothing else
Everything Is a Resource
•Version 1.0.3 of the software release
•The latest version of the software release
•Search results for the word ‘Galactica’
•The next prime number after 1024
•The relationship between Alice and Bob
•A list of open bugs in the bug database

        There shall be nothing else
Clean and Descriptive URIs
Clean and Descriptive URIs
/software/releases/1.0.3.tar.gz
/software/releases/latest.tar.gz
/search/Galactica
/nextprime/1024
/relationships/Alice;Bob
/bugs/by-state/open
State(lessness)


Application vs. Resource
The Uniform Interface
The Uniform Interface

       GET - safe, idempotent
       PUT - idempotent
       DELETE - idempotent
       POST - “complex”
The Uniform Interface

      200 - OK
      201 - Created
      301 - Moved Permanently
      400 - Bad Request
      404 - Not Found
      409 - Conflict
      500 - Internal Server Error
Connectedness


                    passenger



          booking



  route
Hypermedia as the Engine
of Application State

                     passenger



           booking



  route
Problems?
Transactions
Asynchronous tasks
Batch jobs
Relationships between
resources
Partial updates
Partial representations
REST                     WS*
Embraces HTTP            Ignores HTTP
No bandwidth overhead    Good tool support
Simplicity               WSDL
Web already is RESTful   “Standards”
HTTPS / HTTP Diges,      Plethora of Security
OAuth                    Standards
Why?
REST overview
REST overview

REST overview

  • 2.
    Web Services Web Service API : 80 (Legacy) System
  • 3.
    Web Services Web Service API : 80 (Legacy) System
  • 4.
    The Types ofWeb Services Big Web Services WS-Notification REST WS-Security RPC style WSDL REST-RPC hybrid SOAP REST
  • 5.
  • 6.
    Representational State Transfer(REST) is a style of software architecture for distributed hypermedia systems such as the World Wide Web. The term Representational State Transfer was introduced and defined in 2000 by Roy Fielding in his doctoral dissertation. Fielding is one of the principal authors of the Hypertext Transfer Protocol (HTTP) specification versions 1.0 and 1.1.
  • 7.
    Bookings Application HTTP Routes Passengers
  • 8.
    Resources Bookings Application HTTP Routes Passengers
  • 9.
    Resources POST /booking/{id}/ GET Application /route/{id}/ PUT DELETE /passenger/{id}/
  • 10.
    Addressable Resources POST /booking/{id}/ GET Application /route/{id}/ PUT DELETE /passenger/{id}/
  • 11.
    Uniform Addressable Interface Resources POST /booking/{id}/ GET Application /route/{id}/ PUT DELETE /passenger/{id}/
  • 12.
    Addressable Resources GET /booking/123/ /booking/{id}/ Application /route/{id}/ /passenger/{id}/
  • 13.
    Addressable Resources GET /booking/123/ /booking/{id}/ Application /route/{id}/ /passenger/{id}/ State and Representation
  • 14.
    Addressable Resources GET /booking/123/ /booking/{id}/ Application /route/{id}/ 200 OK /passenger/{id}/ id: 123, pickupTime: ‘2010-12-13T09:00:00’, passenger: { State and link: { href: ‘/passenger/234’, Representation rel: ‘related’ } }
  • 15.
    REST = HTTPUsed Right REST was “developed” in parallel with the HTTP/1.1 protocol Caching and conditional GET Proxies HTTP headers (e.g.content negotiation) HTTP methods
  • 16.
    Everything Is aResource There shall be nothing else
  • 17.
    Everything Is aResource ROA There shall be nothing else
  • 18.
    Everything Is aResource •Version 1.0.3 of the software release •The latest version of the software release •Search results for the word ‘Galactica’ •The next prime number after 1024 •The relationship between Alice and Bob •A list of open bugs in the bug database There shall be nothing else
  • 19.
  • 20.
    Clean and DescriptiveURIs /software/releases/1.0.3.tar.gz /software/releases/latest.tar.gz /search/Galactica /nextprime/1024 /relationships/Alice;Bob /bugs/by-state/open
  • 21.
  • 22.
  • 23.
    The Uniform Interface GET - safe, idempotent PUT - idempotent DELETE - idempotent POST - “complex”
  • 24.
    The Uniform Interface 200 - OK 201 - Created 301 - Moved Permanently 400 - Bad Request 404 - Not Found 409 - Conflict 500 - Internal Server Error
  • 25.
    Connectedness passenger booking route
  • 26.
    Hypermedia as theEngine of Application State passenger booking route
  • 27.
    Problems? Transactions Asynchronous tasks Batch jobs Relationshipsbetween resources Partial updates Partial representations
  • 28.
    REST WS* Embraces HTTP Ignores HTTP No bandwidth overhead Good tool support Simplicity WSDL Web already is RESTful “Standards” HTTPS / HTTP Diges, Plethora of Security OAuth Standards
  • 29.