Representational State Transfer (REST)

2 years ago

Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

No comments yet

Post a comment

    Login or Signup to post a comment
    Login to SlideShare
    Login to Twitter
    Edit your comment Cancel

    Follow SlideShare

    Representational State Transfer (REST) - Presentation Transcript

    1. Implemen'ng  RESTful  Web  Services   Jeremy  Deane     Director  of  Research  &  Architecture   h@p://www.jeremydeane.net/  
    2. WS-­‐*  Failure?   Increasing  Complexity   A  survey  of  278  IT  pros  found  that  32%  of  those  using   SOA  said  those  projects  fell  short  of  expecta'ons.  Of   those,  58%  said  their  SOA  projects  introduced  more   complexity  into  their  IT  environments,  and  30%  said   they  cost  more  than  expected.   Informa'on  Week  August  2008   Complex  Integra/on   As  the  number  of  compe'ng  (and  completed)  web   services  specifica'ons  con'nues  to  grow,  tension  rises   in  direct  propor'on  to  the  increasing  complexity.   Dr.  Dobbs    June  2008  
    3. To  the  RESTcue   REST  does  what  [the  SOAP  stack]  was  trying  to  do  in  a   much  more  viable,  elegant,  cheap,  affordable  way   except  that  we've  got  no  tooling  around  it  yet.     Tim  Bray  August  2008   Standards-­‐based   Fewer  requirements   REST  is  based  on  a  small   REST  requires  far  fewer   set  of  widely-­‐accepted   development  steps,   standards  such  as  HTTP   toolkits  and  execu'on   URI,  and  XML   engines  than  SOAP   REST  is  simple.   Simple  Integra/on  
    4. REST  Conceptual  Model   part  of   Execu'on   constrains   Policies  and   Context   Contracts   part  of   use   limits  use  of   Service   Service   Consumer   seeks   provide  access  to   Real-­‐World   represents   hosts   Resource   Resource   Effect   Provider   Key   returns   OASIS  SOA   Concepts   iden'fies   Resource   Resource   REST   Representa'on   Iden'fier   Concepts  
    5. Representa'onal  State  Transfer  (REST)     «execu'on  environment»   «execu'on  environment»   Web  Applica/on   Web  Applica/on   HTTP  GET  Request   Service   Consumer   HTTP  Response:  200  (ok)   URI   Provider   XML   Representa'on   Web  Principles   REST  is  an  architectural  style  based  on  the  principles  of  the  web   URI   A  service  provides  access  to  a  resource,  iden'fied  by  a   Universal  Resource  Indicator  (URI),  over  HTTP   HTTP  Methods   HTTP  methods  (e.g.  GET,  PUT,  POST,  and  DELETE)  define  a   uniform  interface   Resource   Consumer  and  provider  exchange  immutable  representa'ons   Representa'ons   of  a  resource  that  may  itself  contain  links  to  other  resources  
    6. Resources  &  Universal  Resource  Iden'fiers  (URI)   A  resource  is  an  abstract  set  of  data   Examples: Building, Room, floor A  resource  representa'on  is  iden'fied  by  a  URI   /building/{building-id} /building/{building-id}/room/{room-id} A  URI  does  NOT  contain  verbs  or  resource  iden'fying  parameters   Incorrect   /building/{building-id}?action=update Correct   /building/{building-id}/room/{room-id} Incorrect   /building/{building-id}/delete/room/{room-id}
    7. Representa'ons   A  representa'on  is  an   A  representa'on  is  self-­‐ immutable  physical   descrip've  and  stateless   snapshot  of  a  resource   Representa/on   The  most  common   resource  representa'on   A  representa'on  may   is  XML  but  other  popular   contain  links  to  other   formats  include  JSON   resources  (hypermedia)   and  XHTML  
    8. State  Transfer   Applica'on  State   Maintenance   State  transfer  refers  to  the  ApplicaHon  state   ApplicaHon  state  is  maintained  by  the   between  a  consumer  and  provider.  It  does   consumer  while  Resource  state  is   NOT  refer  to  the  state  of  a  given  resource.   maintained  by  the  provider.   No  side  effects   Idempotent   Duplicate  requests  to  create,  update,  or   A  request  for  a  resource  should  not  change   delete  a  resource  should  not  result  in  a   the  state  of  a  resource  (no  side  effects).   change  in  Resource  state.  
    9. Hypertext  Transfer  Protocol  (HTTP)  Uniform  Interface   HTTP  is  stateless  request-­‐response  applica'on  protocol   The  transport  layer  is   Request  and  response   Requests  can  be   secured  using  Secure   messages  are  comprised   authen'cated  using     Sockets  Layer  (SSL)  and  the   of  a  command,  headers,   HTTP  Basic  Authen'ca'on   message  body  is  secured   and  a  body   using  encryp'on  and   digital  signatures   HTTP  defines  a  universal  interface  to  resources  (CRUD):   Ac'on   Result   PUT /building/{building-id} Creates a resource GET /building/{building-id} Retrieves a resource representation POST /building/{building-id} Updates a resource DELETE /building/{building-id} Deletes a resource
    10. Content  Nego'a'on   URI  Content  ID   /building/{building-id}/room/pdf/{room-id} URI  Content  Extensions   /building/{building-id}/room/{room-id}.xml Accept  Headers  –  Media  Types   Accept Headers = text/xml
    11. SOAP  vs.  RESTful  Web  Service   HTTP  Request  or  Response   HTTP  Request  or  Response   HTTP  HEADERS   HTTP  HEADERS   HTTP  Body   HTTP  Body   SOAP  Envelope   XML  Document   SOAP  HEADERS   SOAP  Body   XML  Document  
    12. SOAP  vs.  RESTful  Web  Services   Advantage   Disadvantage   • Simplicity   • Proven  architectural  style   REST-­‐XML   (Web)   • Lack  of  specifica'on  format   • Fewer  development  steps,   (e.g.  WSDL)   toolkits  and  execu'on   engines   • Complexity   • Ever-­‐changing,  vendor-­‐driven   • Transport  Independence   SOAP-­‐XML   specifica'ons   • Intelligent  messages   • Requires  complex  tools  and   frameworks  
    13. REST  Web  Service  Frameworks   h@p://jboss.org/resteasy   h@p://blog.springsource.com/ 2009/03/08/rest-­‐in-­‐spring-­‐3-­‐mvc/   h@p://www.1060research.com/netkernel/  
    14. Restlet  Framework   Open  source   Restlet  is  a  lightweight  open  source  framework  for   framework   implemen'ng  REST  concepts  in  Java   Restlet  web  services  are  created  by  configuring  the  web.xml   Web  services   and  implemen'ng  abstract  classes   A  router  delegates  to  resources  in  the  same  way  that  a   Delega/on   Struts  controller  delegates  to  ac'ons   The  router  maps  external  requests  to  resources  based  on  a   URI   Universal  Resource  Indicator  (URI)   A  guard  is  also  associated  to  a  router  and  provides  a   Guard   mechanism  for  client  authen'ca'on.  
    15. Restlet  Components   Guard   Resource   «delegate»   Router   Resource   URI  –     Resource   Resource  Mappings  
    16. Facili'es  Management  Demo   UML  Sequence  Diagram:  Update  Building   The  demo  web  applica'ons,  along  with  the  source  code  and  tests,   Demo  Download   can  be  downloaded  from        hPp://files.me.com/jtdeane/0udh04   The  web  services  expose  transac'ons  for  managing  facili'es.  For   Web  Services   example,  web  services  exist  for  crea'ng,  retrieving,  upda'ng,  and   dele'ng  buildings.  
    17. Addi'onal  Resources   RESTful  Web   RESTful  Web   Services  vs.  WS-­‐*   RESTful  Web  Services     Services  Cookbook   REST  An'-­‐Pa@erns   Web  Services     by  Tilkov   By  Richardson   By  Allamaraju   By  Zimmermann   Introduc'on  to   Resource-­‐Oriented   Hypermedia  in   Resource-­‐Oriented   Architecture:   RESTful  applica'ons   Compu'ng   Resource  Metadata   By  Baker   by  1060  Research   by  Brian  Sle@en      
    18. Ques'ons  &  Feedback   Jeremy  Deane     Director  of  Research  &  Architecture   My  Contact   Plymouth  Rock  Assurance   informa/on:   jeremy.deane@gmail.com   h@p://www.jeremydeane.net/   The source code along with instructions for building, installing and running the demo can be downloaded from http://files.me.com/jtdeane/0udh04

    Jeremy DeaneJeremy Deane + Follow

    660 views, 0 favs, 2 embeds more

    About this presentation

    Usage Rights

    © All Rights Reserved

    Stats

    • 0 Favorites
    • 0 Comments
    • 0 Downloads
    • 644 Views on
      SlideShare
    • 16 Views on
      Embeds
    • 660 Total Views

    Embed views

    • 10 views on http://ithirewire.com
    • 6 views on http://www.slideshare.net

    more

    Embed views

    • 10 views on http://ithirewire.com
    • 6 views on http://www.slideshare.net

    less

    Accessibility

    Additional Details

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint

    Categories

    Tags