SlideShare una empresa de Scribd logo
1 de 23
Descargar para leer sin conexión
Teaching Old Services New
Tricks: Adding HATEOAS Support
        as an Afterthought
   Olga Liskin, Leif Singer, Kurt Schneider
   {olga.liskin, leif.singer, kurt.schneider}
            @inf.uni-hannover.de
                    28.03.2011
Content
    Motivation
    Main Goals
    Service Example
    Terminology
    Notation for Application Models
    Conception of Wrapper Component
    Comparison
    Conclusions & Outlook




            Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider   28.03.2011   2
Motivation
  Problem with web service communication: Client needs to
  know exactly, what a request has to look like
  Many sources for errors
  –  Coding errors
  –  Invalid requests
  Idea: Server includes request-information in response
  messages
  –  Which requests allowed next
  –  What they look like
  HATEOAS
  But: not many services conform to this principle



            Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider   28.03.2011   3
Motivation
Example:


     Service response without HATEOAS:

     HTTP/1.1 200 OK
                                            What can the client
     Last-Modified: Wed, 01 Dec 2010 17:36:02 GMT next?
                                                 do
     Content-Type: application/xml
     <task>
       <id>208</id>
       <name>create GUI</name>              No idea. The client
       <status>inprogress</status>            has to know by
                                                   itself.
       <parentStoryId>04</parentStoryId>
     </task>




             Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider   28.03.2011   4
Motivation
Example:
     Service response with HATEOAS:

     HTTP/1.1 200 OK
     Last-Modified: Wed, 01 Dec 2010 17:36:02 GMT                                Control elements
     Content-Type: application/xml                                               directly present in
     Link: <stories/04/tasks/208/finish>; rel=“finish”                          response message.
     Link: <stories/04/tasks/208/block>; rel=“block”
     <task>
       <id>208</id>                                                             Now client can see
       <name>create GUI</name>                                                  following requests
       <status>inprogress</status>                                               and how to make
                                                                                       them
       <parentStory>/stories/04</parentStory>
     </task>



        …and also indicate
              this




            Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider                28.03.2011   5
Main Goals
  Create HATEOAS support using state charts
  –  Automatically generate a wrapper

                           Service
                         Information
                                       Generator/
                                                              Wrapper
                                       Interpreter
             Developer




                                          Client              Wrapper              Server




  Prerequisite: Clear way to model network-based applications
  –  State Charts
  –  Terminology


           Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider      28.03.2011   6
Service Example
Backlog service: support agile development projects
   Backlog
   –  contains story cards


  Story Card
   –  One particular topic
   –  Different states
         „definde“, „in progress“, „blocked“,…
         Depend on included tasks

  Task
   –  Story Card divided into tasks
   –  Different states
         Changed by user




             Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider   28.03.2011   7
1 Modelling Network-Based
Applications

   Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider   28.03.2011   8
Terminology
  Valid requests depend on current application state
  What exactly is application state?

  Relevant terminology:
  –  application
         „representation of the business-aware functionality of a system“ (Fielding)
  –  resource state
         Values of a resource‘s attributes
  –  application state
         Requests, responses and the processing of those
         E.g.: „process detail view of a story card“




             Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider   28.03.2011   9
Terminology

                                                                   31

                                                                                             finished



Backlog                                                08
                                                                                        24




                                                                                 blocked
  New idea:                                                                                     Story
   –  Equivalence classes of application states
            Combine „similar“ states
            Determined by resource class and resource state




               Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider     28.03.2011   10
State Chart
  States
  –  Equivalence classes of application states
  –  Composite States combine states with same resource class




           Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider   28.03.2011   11
State Chart
  Transitions
  –  Possible change of application state
        triggered by new client request
  –  Target state reached in case of success
  Transitions between Simple States




            Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider   28.03.2011   12
State Chart
  Transitions between Composite States
  –  More precise information about control flow
      necessary
  –  Outgoing transition:
        Transition possible from all sub-states


  –  Incoming transition:
        Client requests a resource of
        particular class
        Sub-state can only be determined
        at runtime
        choice-pseudostate




            Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider   28.03.2011   13
State Chart
  Simplified notation
  –  Remove end vertex
  –  Remove choice pseudostate construct




           Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider   28.03.2011   14
State Chart
  Use State Chart as a static map




          Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider   28.03.2011   15
2 Constructing A Wrapper


   Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider   28.03.2011   16
Wrapper - Conception
  Top-Down view
  –  Wrapper at first as black-box
  Insert wrapper between client and server


                             Request                             Request

            Client                           Wrapper                               Server
                             HATEOAS-
                             Response                            Response
                             Response

  –  Request forwarded
  –  Response enriched with transitions
        But not changed further




            Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider     28.03.2011   17
Wrapper - Conception
Main process

 Request    Wrapper                                                                         Request
                                                      Forward
                                                      request
                                                                   1
 Request                                                                                    Request
                       Enrich response                                                      Response
                                                      Calculate
                                                     application
                                                        state      2
                                                     application
                                                       state

                       <<datastore>>   transitions     Look up
                         Transition
                           model                     transitions
 HATEOAS-                                                          3
                                                        valid
 Response
 HATEOAS-                                            transitions                            Response
 Response
                                                     Construct
                                                       links
                                                                   4




              Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider   28.03.2011   18
Wrapper - Concrete Process Steps
Full process cycle
    HTTP/1.1 200 OK 	
  
    Last-Modified: Wed, 01 Dec 2010 	
  
                                           Local-name(/*[1]) = task
    Content-Type: application/xml	
        /task/status/text() = defined
    <task>	
  
      <id>04</id>	
  
      <name>Update Database</name>	
  
      <status>defined</status>	
  
      <parentStory>08</parentStory>	
  
    </task>




     HTTP/1.1 200 OK 	
                                                                                /task/id/text() = 04
     Last-Modified: Wed, 01 Dec 2010 	
                                          URI-Templates         /task/parentStory/text() = 08
     Content-Type: application/xml
     Link: </stories/08/tasks/04/block>;rel=”Task.block”
     Link: </stories/08/tasks/04/begin>;rel=”Task.begin”
     Link: </stories/08/tasks>; rel=”Task.allTasks”
     Link: </stories/08>; rel=”belongs_to_story”
                                                                           Task.block:    </stories/08/tasks/04/block>
     <task>	
  
                                                                           Task.begin:     </stories/08/tasks/04/begin>
       <id>04</id>	
                                                       Task.allTasks:    </stories/08/tasks>
       <name>Update Database</name>	
                                      Belongs_To_Story: </stories/08>
       <status>defined</status>	
  
       <parentStory>08</parentStory>	
  
     </task>




                  Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider                     28.03.2011           19
Comparison
    Implementation of backlog service
    Automated generation of wrapper (from transition model)
    Develop 2 clients to test concepts
     –  With wrapper <-> without wrapper

List links =                                           if(story.getStatus().equals(StoryStatus
      response.getHeaders().get("Link");                        .Defined)){
  for(String link : links){                                this.startButton.setEnabled(true);
    if(link.contains("story.start")){                      this.startButton.setUri("/stories/"+
      String uri = extractUri(link);                            story.getId() + "/start");
      this.startButton.setUri(uri);                        this.blockButton.setEnabled(true);
      this.startButton.setEnabled(true);                   this.blockButton.setUri("/stories/"+
    }//...                                                      story.getId() + "/block")
  }                                                      }




               Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider   28.03.2011   20
Conclusions
  Creation of theoretical concepts
  Development of wrapper process
  Check the concept

  Is working
  Generic
  Improves development and maintainance of clients

  Errors in model lead to invalid/missing links
  Input data is complex



           Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider   28.03.2011   21
Outlook
  Further research on input of data
  –  Project environment
  –  Interface descriptions (e.g. WADL) as additional source
  Allow changes of whole service API
  –  Can improve more REST aspects
  Use state charts for creation of services (not only wrappers)




            Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider   28.03.2011   22
Content
    Motivation
    Main Goals
    Service Example
    Terminology
    Notation for Application Models
    Conception of Wrapper Component
    Comparison
    Conclusions & Outlook



                                           Questions?


            Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider   28.03.2011   23

Más contenido relacionado

Destacado

Cspd san fran2011
Cspd san fran2011Cspd san fran2011
Cspd san fran2011tbg-designs
 
IT復興円卓会議資料
IT復興円卓会議資料IT復興円卓会議資料
IT復興円卓会議資料Ishii Miho
 
Xtremekeratincare.com
Xtremekeratincare.comXtremekeratincare.com
Xtremekeratincare.comxtremekeratin
 
Hecate, Managing Authorization with RESTful XML
Hecate, Managing Authorization with RESTful XMLHecate, Managing Authorization with RESTful XML
Hecate, Managing Authorization with RESTful XMLruyalarcon
 
Wsrest13 gilherme keynote
Wsrest13 gilherme keynoteWsrest13 gilherme keynote
Wsrest13 gilherme keynoteruyalarcon
 
Fulfilling the Hypermedia Constraint via HTTP OPTIONS, The HTTP Vocabulary In...
Fulfilling the Hypermedia Constraint via HTTP OPTIONS, The HTTP Vocabulary In...Fulfilling the Hypermedia Constraint via HTTP OPTIONS, The HTTP Vocabulary In...
Fulfilling the Hypermedia Constraint via HTTP OPTIONS, The HTTP Vocabulary In...ruyalarcon
 
RestFS: Resources and Services are Filesystems, Too
RestFS: Resources and Services are Filesystems, TooRestFS: Resources and Services are Filesystems, Too
RestFS: Resources and Services are Filesystems, Tooruyalarcon
 
XML Technologies for RESTful Services Development
XML Technologies for RESTful Services DevelopmentXML Technologies for RESTful Services Development
XML Technologies for RESTful Services Developmentruyalarcon
 
REST and Linked Data: a match made for domain driven development?
REST and Linked Data: a match made for domain driven development?REST and Linked Data: a match made for domain driven development?
REST and Linked Data: a match made for domain driven development?ruyalarcon
 
Jackson m ci583_the artist teacher identity in the classroom
Jackson m ci583_the artist teacher identity in the classroomJackson m ci583_the artist teacher identity in the classroom
Jackson m ci583_the artist teacher identity in the classroommkjackson
 
A Framework for Self-descriptive RESTful Services
A Framework for Self-descriptive RESTful ServicesA Framework for Self-descriptive RESTful Services
A Framework for Self-descriptive RESTful Servicesruyalarcon
 
REST: From GET to HATEOAS
REST: From GET to HATEOASREST: From GET to HATEOAS
REST: From GET to HATEOASJos Dirksen
 
Roman inventions (group 9)
Roman inventions (group 9)Roman inventions (group 9)
Roman inventions (group 9)kochh13
 

Destacado (19)

Propuesta grupal
Propuesta grupal Propuesta grupal
Propuesta grupal
 
The Red Sea Crossing
The Red Sea CrossingThe Red Sea Crossing
The Red Sea Crossing
 
English class 4
English class 4English class 4
English class 4
 
Cspd san fran2011
Cspd san fran2011Cspd san fran2011
Cspd san fran2011
 
IT復興円卓会議資料
IT復興円卓会議資料IT復興円卓会議資料
IT復興円卓会議資料
 
Xtremekeratincare.com
Xtremekeratincare.comXtremekeratincare.com
Xtremekeratincare.com
 
Presentación ingles evet2edu
Presentación ingles evet2eduPresentación ingles evet2edu
Presentación ingles evet2edu
 
Hecate, Managing Authorization with RESTful XML
Hecate, Managing Authorization with RESTful XMLHecate, Managing Authorization with RESTful XML
Hecate, Managing Authorization with RESTful XML
 
S1 intro
S1 introS1 intro
S1 intro
 
Wsrest13 gilherme keynote
Wsrest13 gilherme keynoteWsrest13 gilherme keynote
Wsrest13 gilherme keynote
 
Fulfilling the Hypermedia Constraint via HTTP OPTIONS, The HTTP Vocabulary In...
Fulfilling the Hypermedia Constraint via HTTP OPTIONS, The HTTP Vocabulary In...Fulfilling the Hypermedia Constraint via HTTP OPTIONS, The HTTP Vocabulary In...
Fulfilling the Hypermedia Constraint via HTTP OPTIONS, The HTTP Vocabulary In...
 
RestFS: Resources and Services are Filesystems, Too
RestFS: Resources and Services are Filesystems, TooRestFS: Resources and Services are Filesystems, Too
RestFS: Resources and Services are Filesystems, Too
 
XML Technologies for RESTful Services Development
XML Technologies for RESTful Services DevelopmentXML Technologies for RESTful Services Development
XML Technologies for RESTful Services Development
 
REST and Linked Data: a match made for domain driven development?
REST and Linked Data: a match made for domain driven development?REST and Linked Data: a match made for domain driven development?
REST and Linked Data: a match made for domain driven development?
 
Trabajo de excel
Trabajo de excelTrabajo de excel
Trabajo de excel
 
Jackson m ci583_the artist teacher identity in the classroom
Jackson m ci583_the artist teacher identity in the classroomJackson m ci583_the artist teacher identity in the classroom
Jackson m ci583_the artist teacher identity in the classroom
 
A Framework for Self-descriptive RESTful Services
A Framework for Self-descriptive RESTful ServicesA Framework for Self-descriptive RESTful Services
A Framework for Self-descriptive RESTful Services
 
REST: From GET to HATEOAS
REST: From GET to HATEOASREST: From GET to HATEOAS
REST: From GET to HATEOAS
 
Roman inventions (group 9)
Roman inventions (group 9)Roman inventions (group 9)
Roman inventions (group 9)
 

Similar a Teaching Old Services New Tricks: Adding HATEOAS Support as an Afterthought

Strata+Hadoop 2015 NYC End User Panel on Real-Time Data Analytics
Strata+Hadoop 2015 NYC End User Panel on Real-Time Data AnalyticsStrata+Hadoop 2015 NYC End User Panel on Real-Time Data Analytics
Strata+Hadoop 2015 NYC End User Panel on Real-Time Data AnalyticsSingleStore
 
The art of the event streaming application: streams, stream processors and sc...
The art of the event streaming application: streams, stream processors and sc...The art of the event streaming application: streams, stream processors and sc...
The art of the event streaming application: streams, stream processors and sc...confluent
 
Kafka summit SF 2019 - the art of the event-streaming app
Kafka summit SF 2019 - the art of the event-streaming appKafka summit SF 2019 - the art of the event-streaming app
Kafka summit SF 2019 - the art of the event-streaming appNeil Avery
 
Streaming and Social Media
Streaming and Social MediaStreaming and Social Media
Streaming and Social MediaJoe Olson
 
Practical Ontology For Enterprise Data Management
Practical Ontology For Enterprise Data ManagementPractical Ontology For Enterprise Data Management
Practical Ontology For Enterprise Data ManagementRichard Green
 
Pinpoint Ceph Bottleneck Out of Cluster Behavior Mists - Yingxin Cheng
Pinpoint Ceph Bottleneck Out of Cluster Behavior Mists - Yingxin ChengPinpoint Ceph Bottleneck Out of Cluster Behavior Mists - Yingxin Cheng
Pinpoint Ceph Bottleneck Out of Cluster Behavior Mists - Yingxin ChengCeph Community
 
Porting Spring PetClinic to GigaSpaces
Porting Spring PetClinic to GigaSpacesPorting Spring PetClinic to GigaSpaces
Porting Spring PetClinic to GigaSpacesUri Cohen
 
Ogce Workflow Suite
Ogce Workflow SuiteOgce Workflow Suite
Ogce Workflow Suitesmarru
 
Agile SOA - Agile EAI
Agile SOA - Agile EAIAgile SOA - Agile EAI
Agile SOA - Agile EAIRichard Green
 
Presentation online application upgrade of oracle's bug db with edition-ba...
Presentation    online application upgrade of oracle's bug db with edition-ba...Presentation    online application upgrade of oracle's bug db with edition-ba...
Presentation online application upgrade of oracle's bug db with edition-ba...xKinAnx
 
Data Apps with the Lambda Architecture - with Real Work Examples on Merging B...
Data Apps with the Lambda Architecture - with Real Work Examples on Merging B...Data Apps with the Lambda Architecture - with Real Work Examples on Merging B...
Data Apps with the Lambda Architecture - with Real Work Examples on Merging B...Altan Khendup
 
IRJET- Top-K Query Processing using Top Order Preserving Encryption (TOPE)
IRJET- Top-K Query Processing using Top Order Preserving Encryption (TOPE)IRJET- Top-K Query Processing using Top Order Preserving Encryption (TOPE)
IRJET- Top-K Query Processing using Top Order Preserving Encryption (TOPE)IRJET Journal
 
A Pragmatic Approach to Identity and Access Management
A Pragmatic Approach to Identity and Access ManagementA Pragmatic Approach to Identity and Access Management
A Pragmatic Approach to Identity and Access Managementhankgruenberg
 
Et2541 fp topic_11
Et2541 fp topic_11Et2541 fp topic_11
Et2541 fp topic_11Nitin AB
 
Collaborate 2012-business data transformation and consolidation
Collaborate 2012-business data transformation and consolidationCollaborate 2012-business data transformation and consolidation
Collaborate 2012-business data transformation and consolidationChain Sys Corporation
 
Collaborate 2012-business data transformation and consolidation for a global ...
Collaborate 2012-business data transformation and consolidation for a global ...Collaborate 2012-business data transformation and consolidation for a global ...
Collaborate 2012-business data transformation and consolidation for a global ...Chain Sys Corporation
 
Concept Drift Identification using Classifier Ensemble Approach
Concept Drift Identification using Classifier Ensemble Approach  Concept Drift Identification using Classifier Ensemble Approach
Concept Drift Identification using Classifier Ensemble Approach IJECEIAES
 
Apricot2017 Request tracing in distributed environment
Apricot2017 Request tracing in distributed environmentApricot2017 Request tracing in distributed environment
Apricot2017 Request tracing in distributed environmentHieu LE ☁
 
Logging/Request Tracing in Distributed Environment
Logging/Request Tracing in Distributed EnvironmentLogging/Request Tracing in Distributed Environment
Logging/Request Tracing in Distributed EnvironmentAPNIC
 

Similar a Teaching Old Services New Tricks: Adding HATEOAS Support as an Afterthought (20)

End User ServicesV1.0 training.ppt
End User ServicesV1.0 training.pptEnd User ServicesV1.0 training.ppt
End User ServicesV1.0 training.ppt
 
Strata+Hadoop 2015 NYC End User Panel on Real-Time Data Analytics
Strata+Hadoop 2015 NYC End User Panel on Real-Time Data AnalyticsStrata+Hadoop 2015 NYC End User Panel on Real-Time Data Analytics
Strata+Hadoop 2015 NYC End User Panel on Real-Time Data Analytics
 
The art of the event streaming application: streams, stream processors and sc...
The art of the event streaming application: streams, stream processors and sc...The art of the event streaming application: streams, stream processors and sc...
The art of the event streaming application: streams, stream processors and sc...
 
Kafka summit SF 2019 - the art of the event-streaming app
Kafka summit SF 2019 - the art of the event-streaming appKafka summit SF 2019 - the art of the event-streaming app
Kafka summit SF 2019 - the art of the event-streaming app
 
Streaming and Social Media
Streaming and Social MediaStreaming and Social Media
Streaming and Social Media
 
Practical Ontology For Enterprise Data Management
Practical Ontology For Enterprise Data ManagementPractical Ontology For Enterprise Data Management
Practical Ontology For Enterprise Data Management
 
Pinpoint Ceph Bottleneck Out of Cluster Behavior Mists - Yingxin Cheng
Pinpoint Ceph Bottleneck Out of Cluster Behavior Mists - Yingxin ChengPinpoint Ceph Bottleneck Out of Cluster Behavior Mists - Yingxin Cheng
Pinpoint Ceph Bottleneck Out of Cluster Behavior Mists - Yingxin Cheng
 
Porting Spring PetClinic to GigaSpaces
Porting Spring PetClinic to GigaSpacesPorting Spring PetClinic to GigaSpaces
Porting Spring PetClinic to GigaSpaces
 
Ogce Workflow Suite
Ogce Workflow SuiteOgce Workflow Suite
Ogce Workflow Suite
 
Agile SOA - Agile EAI
Agile SOA - Agile EAIAgile SOA - Agile EAI
Agile SOA - Agile EAI
 
Presentation online application upgrade of oracle's bug db with edition-ba...
Presentation    online application upgrade of oracle's bug db with edition-ba...Presentation    online application upgrade of oracle's bug db with edition-ba...
Presentation online application upgrade of oracle's bug db with edition-ba...
 
Data Apps with the Lambda Architecture - with Real Work Examples on Merging B...
Data Apps with the Lambda Architecture - with Real Work Examples on Merging B...Data Apps with the Lambda Architecture - with Real Work Examples on Merging B...
Data Apps with the Lambda Architecture - with Real Work Examples on Merging B...
 
IRJET- Top-K Query Processing using Top Order Preserving Encryption (TOPE)
IRJET- Top-K Query Processing using Top Order Preserving Encryption (TOPE)IRJET- Top-K Query Processing using Top Order Preserving Encryption (TOPE)
IRJET- Top-K Query Processing using Top Order Preserving Encryption (TOPE)
 
A Pragmatic Approach to Identity and Access Management
A Pragmatic Approach to Identity and Access ManagementA Pragmatic Approach to Identity and Access Management
A Pragmatic Approach to Identity and Access Management
 
Et2541 fp topic_11
Et2541 fp topic_11Et2541 fp topic_11
Et2541 fp topic_11
 
Collaborate 2012-business data transformation and consolidation
Collaborate 2012-business data transformation and consolidationCollaborate 2012-business data transformation and consolidation
Collaborate 2012-business data transformation and consolidation
 
Collaborate 2012-business data transformation and consolidation for a global ...
Collaborate 2012-business data transformation and consolidation for a global ...Collaborate 2012-business data transformation and consolidation for a global ...
Collaborate 2012-business data transformation and consolidation for a global ...
 
Concept Drift Identification using Classifier Ensemble Approach
Concept Drift Identification using Classifier Ensemble Approach  Concept Drift Identification using Classifier Ensemble Approach
Concept Drift Identification using Classifier Ensemble Approach
 
Apricot2017 Request tracing in distributed environment
Apricot2017 Request tracing in distributed environmentApricot2017 Request tracing in distributed environment
Apricot2017 Request tracing in distributed environment
 
Logging/Request Tracing in Distributed Environment
Logging/Request Tracing in Distributed EnvironmentLogging/Request Tracing in Distributed Environment
Logging/Request Tracing in Distributed Environment
 

Teaching Old Services New Tricks: Adding HATEOAS Support as an Afterthought

  • 1. Teaching Old Services New Tricks: Adding HATEOAS Support as an Afterthought Olga Liskin, Leif Singer, Kurt Schneider {olga.liskin, leif.singer, kurt.schneider} @inf.uni-hannover.de 28.03.2011
  • 2. Content   Motivation   Main Goals   Service Example   Terminology   Notation for Application Models   Conception of Wrapper Component   Comparison   Conclusions & Outlook Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider 28.03.2011 2
  • 3. Motivation   Problem with web service communication: Client needs to know exactly, what a request has to look like   Many sources for errors –  Coding errors –  Invalid requests   Idea: Server includes request-information in response messages –  Which requests allowed next –  What they look like   HATEOAS   But: not many services conform to this principle Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider 28.03.2011 3
  • 4. Motivation Example: Service response without HATEOAS: HTTP/1.1 200 OK What can the client Last-Modified: Wed, 01 Dec 2010 17:36:02 GMT next? do Content-Type: application/xml <task> <id>208</id> <name>create GUI</name> No idea. The client <status>inprogress</status> has to know by itself. <parentStoryId>04</parentStoryId> </task> Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider 28.03.2011 4
  • 5. Motivation Example: Service response with HATEOAS: HTTP/1.1 200 OK Last-Modified: Wed, 01 Dec 2010 17:36:02 GMT Control elements Content-Type: application/xml directly present in Link: <stories/04/tasks/208/finish>; rel=“finish” response message. Link: <stories/04/tasks/208/block>; rel=“block” <task> <id>208</id> Now client can see <name>create GUI</name> following requests <status>inprogress</status> and how to make them <parentStory>/stories/04</parentStory> </task> …and also indicate this Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider 28.03.2011 5
  • 6. Main Goals   Create HATEOAS support using state charts –  Automatically generate a wrapper Service Information Generator/ Wrapper Interpreter Developer Client Wrapper Server   Prerequisite: Clear way to model network-based applications –  State Charts –  Terminology Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider 28.03.2011 6
  • 7. Service Example Backlog service: support agile development projects   Backlog –  contains story cards   Story Card –  One particular topic –  Different states   „definde“, „in progress“, „blocked“,…   Depend on included tasks   Task –  Story Card divided into tasks –  Different states   Changed by user Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider 28.03.2011 7
  • 8. 1 Modelling Network-Based Applications Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider 28.03.2011 8
  • 9. Terminology   Valid requests depend on current application state   What exactly is application state?   Relevant terminology: –  application   „representation of the business-aware functionality of a system“ (Fielding) –  resource state   Values of a resource‘s attributes –  application state   Requests, responses and the processing of those   E.g.: „process detail view of a story card“ Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider 28.03.2011 9
  • 10. Terminology 31 finished Backlog 08 24 blocked   New idea: Story –  Equivalence classes of application states   Combine „similar“ states   Determined by resource class and resource state Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider 28.03.2011 10
  • 11. State Chart   States –  Equivalence classes of application states –  Composite States combine states with same resource class Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider 28.03.2011 11
  • 12. State Chart   Transitions –  Possible change of application state   triggered by new client request –  Target state reached in case of success   Transitions between Simple States Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider 28.03.2011 12
  • 13. State Chart   Transitions between Composite States –  More precise information about control flow necessary –  Outgoing transition:   Transition possible from all sub-states –  Incoming transition:   Client requests a resource of particular class   Sub-state can only be determined at runtime   choice-pseudostate Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider 28.03.2011 13
  • 14. State Chart   Simplified notation –  Remove end vertex –  Remove choice pseudostate construct Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider 28.03.2011 14
  • 15. State Chart   Use State Chart as a static map Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider 28.03.2011 15
  • 16. 2 Constructing A Wrapper Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider 28.03.2011 16
  • 17. Wrapper - Conception   Top-Down view –  Wrapper at first as black-box   Insert wrapper between client and server Request Request Client Wrapper Server HATEOAS- Response Response Response –  Request forwarded –  Response enriched with transitions   But not changed further Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider 28.03.2011 17
  • 18. Wrapper - Conception Main process Request Wrapper Request Forward request 1 Request Request Enrich response Response Calculate application state 2 application state <<datastore>> transitions Look up Transition model transitions HATEOAS- 3 valid Response HATEOAS- transitions Response Response Construct links 4 Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider 28.03.2011 18
  • 19. Wrapper - Concrete Process Steps Full process cycle HTTP/1.1 200 OK   Last-Modified: Wed, 01 Dec 2010   Local-name(/*[1]) = task Content-Type: application/xml   /task/status/text() = defined <task>   <id>04</id>   <name>Update Database</name>   <status>defined</status>   <parentStory>08</parentStory>   </task> HTTP/1.1 200 OK   /task/id/text() = 04 Last-Modified: Wed, 01 Dec 2010   URI-Templates /task/parentStory/text() = 08 Content-Type: application/xml Link: </stories/08/tasks/04/block>;rel=”Task.block” Link: </stories/08/tasks/04/begin>;rel=”Task.begin” Link: </stories/08/tasks>; rel=”Task.allTasks” Link: </stories/08>; rel=”belongs_to_story” Task.block: </stories/08/tasks/04/block> <task>   Task.begin: </stories/08/tasks/04/begin> <id>04</id>   Task.allTasks: </stories/08/tasks> <name>Update Database</name>   Belongs_To_Story: </stories/08> <status>defined</status>   <parentStory>08</parentStory>   </task> Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider 28.03.2011 19
  • 20. Comparison   Implementation of backlog service   Automated generation of wrapper (from transition model)   Develop 2 clients to test concepts –  With wrapper <-> without wrapper List links = if(story.getStatus().equals(StoryStatus response.getHeaders().get("Link"); .Defined)){ for(String link : links){ this.startButton.setEnabled(true); if(link.contains("story.start")){ this.startButton.setUri("/stories/"+ String uri = extractUri(link); story.getId() + "/start"); this.startButton.setUri(uri); this.blockButton.setEnabled(true); this.startButton.setEnabled(true); this.blockButton.setUri("/stories/"+ }//... story.getId() + "/block") } } Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider 28.03.2011 20
  • 21. Conclusions   Creation of theoretical concepts   Development of wrapper process   Check the concept   Is working   Generic   Improves development and maintainance of clients   Errors in model lead to invalid/missing links   Input data is complex Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider 28.03.2011 21
  • 22. Outlook   Further research on input of data –  Project environment –  Interface descriptions (e.g. WADL) as additional source   Allow changes of whole service API –  Can improve more REST aspects   Use state charts for creation of services (not only wrappers) Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider 28.03.2011 22
  • 23. Content   Motivation   Main Goals   Service Example   Terminology   Notation for Application Models   Conception of Wrapper Component   Comparison   Conclusions & Outlook Questions? Teaching Old Services New Tricks – Olga Liskin, Leif Singer, Kurt Schneider 28.03.2011 23