Composing REST Services

  • Published on

  • View

  • Download

Embed Size (px)


<ul><li>1.Composing REST Services Open Dagstuhl SessionCesare PautassoFaculty of Informatics University of Lugano (USI), Switzerland http://www.pautasso.info6 January 20092009 Cesare Pautasso | 1 </li></ul> <p>2. Web Service Composition Today The WS-BPEL process WS-BPEL 2.0 model is layered on top of the service model definedWSDL 1.1 by WSDL 1.1. [] Both the process and its partners are exposed as WSDL services [BPEL 2.0 Standard, Section 3] 6 January 2009 2009 Cesare Pautasso | 2 3. RESTful Web Services APIs WSDL 1.1 do not use WSDL 1.16 January 2009 2009 Cesare Pautasso | 3 4. The GoalCompose RESTful Web ServicesCompose WSDL Web ServicesUse Business Process Modeling Languages One Solution: BPEL for REST Extend BPEL to support RESTful Web Services6 January 20092009 Cesare Pautasso | 4 5. The GoalCompose RESTful Web ServicesCompose WSDL Web ServicesUse Business Process Modeling Languages Another Solution: JOpera Visual Flow Language with Abstract Service Model Extensible Autonomic Engine Architecture 6 January 20092009 Cesare Pautasso | 5 6. REST in one slide PUT Web Services expose theirdata and functionality trough GET Rresources identified by URIPOST DELETEUniform Interface Principle: Clients interact withthe state of resources through 4 verbs:GET (read), POST (create), PUT (update), DELETEMultiple representations for the same resourceHyperlinks model resource relationships andvalid state transitions6 January 20092009 Cesare Pautasso | www.pautasso.info6 7. Challenges for Composition LanguagesResource addressing through URIHow to interact with dynamic, variable set of URI?Uniform Interface (GET, POST, PUT, DELETE)Does it help to make the verbs explicit in the workflow?Multiple resource representationsHow to negotiate the most appropriate representation?HyperlinksCan the workflow implement state transition logic of aresource and generate new URIs dynamically asprocesses run to guide the clients invoking them? 6 January 2009 2009 Cesare Pautasso | 7 8. JOpera Example: Doodle Map MashupSetup a Doodle with Yahoo! Local search andvisualize the results of the poll on Google Maps6 January 20092009 Cesare Pautasso | 8 9. Doodle Map Mashup ArchitectureWeb Browser Workflow RESTful EngineWeb Services RESTful APIAPIs GET POST GET6 January 2009 2009 Cesare Pautasso | www.pautasso.info9 10. 6 January 2009 2009 Cesare Pautasso | 10 11. BPMRESTful Workflow Web ServiceLanguages Composition6 January 2009 2009 Cesare Pautasso | 11 12. Solution Space BPMWorkflow RESTful Web Service Languages Composition1. Abstract Workflow Service invocation technology does not matter 2. Concrete Workflow BPM Expose service invocation RESTful Workflow Web ServiceLanguagesComposition technologies as explicit constructs in the workflow language 3. RESTful WorkflowBPM Workflow as one kind of resourceRESTfulWorkflowWeb Service LanguagesComposition exposed by a RESTful service 6 January 2009 2009 Cesare Pautasso | www.pautasso.info12 13. 1. Abstract Workflow Example: BPEL/WSDL WSDL 2.0 HTTP Binding can wrap RESTful Web Services (WS-BPEL 2.0 does not support WSDL 2.0) BPEL WSDL 2.0 PUT Operations ... Op_1 Op_2 Op_3 GET R Op_4... HTTP BindingPOST DELETE OpURI MethodOp_1 R PUTPUT Op_2 R GETGETOp_3 R POSTPOST ...Op_4 R DELETEDELETE 6 January 20092009 Cesare Pautasso | 13 14. 2. Concrete Workflow: BPEL for REST Idea: Make REST interaction primitives first-class language constructs BPEL for RESTPUT...GET R...POST DELETER&gt;...6 January 20092009 Cesare Pautasso | 14 15. BPEL for REST New Activities/HandlersPUT GETR esource POSTDELETE Web ServiceWeb Service6 January 2009 2009 Cesare Pautasso | 15 16. BPEL for REST Resource BlockDynamically publish resources from BPELprocesses and handle client requests BPEL for RESTPUT PUT GETR POSTGETP DELETEPUT POSTDELETE GETS POSTDELETE6 January 20092009 Cesare Pautasso | www.pautasso.info16 17. 3. RESTful WorkflowsPUT PGETRPOSTDELETE Use the resource interface abstraction to publish the state of the workflow 6 January 20092009 Cesare Pautasso | 17 18. Workflows as Resources URI Publish workflows as resources identified by the URIs: /package/process /package/process/version /package/process/version/instance /package/process/version/instance/task/package/process/version/instance/task/parameter 6 January 2009 2009 Cesare Pautasso | 18 19. Reading the state of the workflow resources GET /package/processEnumerate deployed process versions GET /package/process/version Enumerate active instances of a given process version GET /package/process/version/instanceRead the current state of a workflow instance GET /package/process/version/instance/task Read the current state of a workflow instance task GET /package/process/version/instance/task/param Read the current value of a workflow instance parameter6 January 20092009 Cesare Pautasso | 19 20. Creating new workflow resources POST /package Deploy new process template into package POST /package/process Deploy new version of a process POST /package/process/version Create new process instance6 January 2009 2009 Cesare Pautasso | 20 21. Updating the workflow resource PUT /package/process/version/instance/task Update the state of a workflow task (e.g., finished, failed) PUT /package/process/version/instance/task/param Write into task parameters some values6 January 2009 2009 Cesare Pautasso | 21 22. Deleting workflow resources DELETE /package/process Undeploy all versions of a process (and all the corresponding process instances) DELETE /package/process/version Undeploy a version of a process (and all of its instances) DELETE /package/process/version/instance Remove the state of a specific process instance only6 January 20092009 Cesare Pautasso | 22 23. Discussion Why should a workflow engine care about REST? Use workflows to compose RESTful Web services Implement RESTful services with a workflow Should a process explicitly include RESTful activities? Or it is better/enough to model REST implicitly? How much of the state of a process instance should be exposed as a resource? How to control which parts are visible?6 January 20092009 Cesare Pautasso | 23 24. Conclusion Business Process Modeling Languages have been applied with success to compose traditional WS-* Web Services (BPM = SOA + BPEL) Business Process Modeling Languages should also be applied to compose RESTful Web Services BPEL for REST is a lightweight BPEL extension for REST and WS-* service composition JOpera for Eclipse is a visual process modeling tool with an extensible engine for composing both kinds of services (and many more)6 January 2009 2009 Cesare Pautasso | 24 25. Some ReferencesR. Fielding, Architectural Styles and the Design of Network-based Software Architectures, PhD Thesis,University of California, Irvine, 2000C. Pautasso, O. Zimmermann, F. Leymann, RESTful WebServices vs. Big Web Services: Making the RightArchitectural Decision, Proc. of the 17th International WorldWide Web Conference (WWW2008), Bejing, China, April 2008C. Pautasso, BPEL for REST, Proc. of the 7th InternationalConference on Business Process Management(BPM 2008), Milano, Italy, September 2008Xiwei (Sherry) Xu, Liming Zhu, Yan Liu, Mark Staples, Resource-Oriented Architecture for Business Processes, APSEC08 6 January 20092009 Cesare Pautasso | 25 26. PhD positions available!Prof. Cesare Pautasso University of Lugano, Switzerland c.pautasso@ieee.orghttp://www.pautasso.info26 2008 Cesare Pautasso </p>