modeling)restful)conversaons) with)extended))...
TRANSCRIPT
Modeling RESTful Conversa5ons with Extended
BPMN Choreography Diagrams
Cesare Pautasso, Ana Ivanchikj University of Lugano (USI)
Switzerland
Silvia Schreier innoQ Deutschland GmbH
Germany
European Conference on SoMware Architecture Cavtat, September 7-‐11
ECSA 2015
RESTful conversa5on
REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstrac5ons and Simplifica5ons èFuture work
2
Resource
URI
Resource
URI
Resource
URI
PUT U
RI
reference create
Link Rela5onships (Hypermedia)
RESTful conversa5on
REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstrac5ons and Simplifica5ons èFuture work
3
Resource
URI
Resource
URI
Resource
URI
PUT U
RI
reference create
Link Rela5onships (Hypermedia) 201 Created
4
REST API structure -‐ RAML
REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstrac5ons and Simplifica5ons èFuture work
5
REST API structure-‐ Swagger
REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstrac5ons and Simplifica5ons èFuture work
6
GET /resource 1 HTTP/1.1
HTTP/1.1 303 See Other Loca5on: /resource2
GET /resource2 HTTP/1.1
HTTP/1.1 200 OK
GET /resource1
Client
Server
303 See OtherLocation:/resource2
GET /resource2
Client
Server
200 OK
REST API dynamics
UML Sequence diagram BPMN Choreography diagram
REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstrac5ons and Simplifica5ons èFuture work
-‐ Redirect -‐
Participant A
Initiating Message
Response Message
Participant B
Choreography Task
Participant A
Initiating Message
Response Message
Participant B
Choreography Task
Participant A
Participant B
Choreography Task
Initiating Message
Response Message
BPMN Choreography
7
Inclusive gateway
Parallel gateway
REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstrac5ons and Simplifica5ons èFuture work
Exclusive gateway
8
GET /resource 1 HTTP/1.1
HTTP/1.1 303 See Other Loca5on: /resource2
GET /resource2 HTTP/1.1
HTTP/1.1 200 OK
GET /resource1
Client
Server
303 See OtherLocation:/resource2
GET /resource2
Client
Server
200 OK
REST API dynamics
UML Sequence diagram BPMN Choreography diagram Our proposal
GET /resource1
303 See OtherLocation: /resource2
GET /resource2
200 OK
REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstrac5ons and Simplifica5ons èFuture work
-‐ Redirect -‐
Extended BPMN Choreography
9
Client
Server
Request
ResponseHyperlink URI
Request
ResponseHyperlink URI
REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstrac5ons and Simplifica5ons èFuture work
AssumpCon: ONE client – ONE server
10
Client
Server
RequestHyperlink URI
Client
Server
AlternativeResponse
Client
Server
AlternativeResponse
RequestHyperlink URI
AlternativeResponse
AlternativeResponse
REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstrac5ons and Simplifica5ons èFuture work
11
Client
Server
Request
ResponseHyperlink URI
Client
Server
Response
RequestHyperlink URI
Request
Response
Hyperlink URI
Request
ResponseHyperlink URI
REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstrac5ons and Simplifica5ons èFuture work
12
Client
Server
RequestHyperlink URI
Response
RequestHyperlink URI
Response
REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstrac5ons and Simplifica5ons èFuture work
Long-‐running Request -‐RESTful Conversa5on Example-‐
13 REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstrac5ons and Simplifica5ons èFuture work
e.g.: hdp://docs.aws.amazon.com/amazonglacier/latest/dev/job-‐opera5ons.html
Long-‐running Request -‐ Happy path -‐
14
Create job POST / job HTTP/1.1
HTTP/1.1 202 Accepted Loca5on: / job / 42
Poll GET / job / 42 HTTP/1.1
HTTP/1.1 200 OK
Read results GET / job / 42 / output HTTP/1.1
HTTP/1.1 200 OK
REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstrac5ons and Simplifica5ons èFuture work
GET / job / 42 HTTP/1.1
HTTP/1.1 303 See Other Loca5on: / job / 42 / output
POST /job
202 AcceptedLocation: /job/42
GET /job/42/output
200 OK
GET /job/42
200 OK 303 See OtherLocation: /job/42/output
GET /job/42/output
200 OK
Long-‐running Request -‐ Resending the request -‐
15
Create job POST / job HTTP/1.1
Poll GET / job / 42 HTTP/1.1
HTTP/1.1 200 OK
GET / job / 42 HTTP/1.1
HTTP/1.1 303 See Other Loca5on: / job / 42 / output
Read results GET / job / 42 / output HTTP/1.1
HTTP/1.1 200 OK
REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstrac5ons and Simplifica5ons èFuture work
HTTP/1.1 202 Accepted Loca5on: / job / 42
POST / job HTTP/1.1 POST /job
202 AcceptedLocation: /job/42
GET /job/42/output
200 OK
GET /job/42
200 OK 303 See OtherLocation: /job/42/output
GET /job/42/output
200 OK
Long-‐running Request -‐ Reading the results -‐
16 REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstrac5ons and Simplifica5ons èFuture work
Create job POST / job HTTP/1.1
Poll GET / job / 42 HTTP/1.1
HTTP/1.1 200 OK
GET / job / 42 HTTP/1.1
HTTP/1.1 303 See Other Loca5on: / job / 42 / output
Read results GET / job / 42 / output HTTP/1.1
HTTP/1.1 200 OK
HTTP/1.1 202 Accepted Loca5on: / job / 42
POST / job HTTP/1.1
GET / job / 42 / output HTTP/1.1
HTTP/1.1 200 OK
POST /job
202 AcceptedLocation: /job/42
GET /job/42/output
200 OK
GET /job/42
200 OK 303 See OtherLocation: /job/42/output
GET /job/42/output
200 OK
17
Long-‐running Request -‐ Dele5ng the output resource -‐
Delete output DELETE / job / 42 / output HTTP/1.1
HTTP/1.1 200 OK
REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstrac5ons and Simplifica5ons èFuture work
Create job POST / job HTTP/1.1
Poll GET / job / 42 HTTP/1.1
HTTP/1.1 200 OK
GET / job / 42 HTTP/1.1
HTTP/1.1 303 See Other Loca5on: / job / 42 / output
Read results GET / job / 42 / output HTTP/1.1
HTTP/1.1 200 OK
HTTP/1.1 202 Accepted Loca5on: / job / 42
POST / job HTTP/1.1
GET / job / 42 / output HTTP/1.1
HTTP/1.1 200 OK
DELETE /job/42/output
200 OK
POST /job
202 AcceptedLocation: /job/42
GET /job/42/output
200 OK
GET /job/42
200 OK 303 See OtherLocation: /job/42/output
GET /job/42/output
200 OK
18
Long-‐running Request -‐ Dele5ng the output resource -‐
Delete output DELETE / job / 42 / output HTTP/1.1
HTTP/1.1 200 OK
REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstrac5ons and Simplifica5ons èFuture work
Create job POST / job HTTP/1.1
Poll GET / job / 42 HTTP/1.1
HTTP/1.1 200 OK
GET / job / 42 HTTP/1.1
HTTP/1.1 303 See Other Loca5on: / job / 42 / output
HTTP/1.1 202 Accepted Loca5on: / job / 42
POST / job HTTP/1.1
DELETE /job/42/output
200 OK
POST /job
202 AcceptedLocation: /job/42
GET /job/42/output
200 OK
GET /job/42
200 OK 303 See OtherLocation: /job/42/output
GET /job/42/output
200 OK
19
Long-‐running Request
Clean up DELETE / job / 42 HTTP/1.1
HTTP/1.1 200 OK
REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstrac5ons and Simplifica5ons èFuture work
Delete output DELETE / job / 42 / output HTTP/1.1
HTTP/1.1 200 OK
Create job POST / job HTTP/1.1
Poll GET / job / 42 HTTP/1.1
HTTP/1.1 200 OK
GET / job / 42 HTTP/1.1
HTTP/1.1 303 See Other Loca5on: / job / 42 / output
HTTP/1.1 202 Accepted Loca5on: / job / 42
POST / job HTTP/1.1
-‐ Dele5ng the job resource -‐
DELETE /job/42/output
200 OK
GET /job/42/output
200 OK
GET /job/42
200 OK 303 See OtherLocation: /job/42/output
GET /job/42/output
200 OK
DELETE /job/42
200 OK
POST /job
202 AcceptedLocation: /job/42
20
Long-‐running Request
REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstrac5ons and Simplifica5ons èFuture work
Create job POST / job HTTP/1.1
HTTP/1.1 202 Accepted Loca5on: / job / 42
POST / job HTTP/1.1
Delete job DELETE / job / 42 HTTP/1.1
HTTP/1.1 200 OK
-‐ Dele5ng the job resource -‐
DELETE /job/42/output
200 OK
GET /job/42/output
200 OK
GET /job/42
200 OK 303 See OtherLocation: /job/42/output
GET /job/42/output
200 OK
DELETE /job/42
200 OK
POST /job
202 AcceptedLocation: /job/42
Long-‐running Request
21 REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstrac5ons and Simplifica5ons èFuture work
POST /job
202 AcceptedLocation: /job/42
DELETE /job/42/output
200 OK
DELETE /job/42
200 OKGET /job/42
200 OK 303 See OtherLocation: /job/42/output
GET /job/42/output
200 OK
Long-‐running Request -‐ Short happy path -‐
22
Create job POST / job HTTP/1.1
HTTP/1.1 202 Accepted Loca5on: / job / 42
Read results GET / job / 42 / output HTTP/1.1
HTTP/1.1 200 OK
REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstrac5ons and Simplifica5ons èFuture work
Poll GET / job / 42 HTTP/1.1
HTTP/1.1 303 See Other Loca5on: / job / 42 / output
POST /job
202 AcceptedLocation: /job/42
DELETE /job/42/output
200 OK
DELETE /job/42
200 OKGET /job/42
200 OK 303 See OtherLocation: /job/42/output
GET /job/42/output
200 OK
23
Long-‐running Request
REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstrac5ons and Simplifica5ons èFuture work
POST /job
202 AcceptedLocation: /job/42
DELETE /job/42/output
200 OK
DELETE /job/42
200 OKGET /job/42
200 OK 303 See OtherLocation: /job/42/output
GET /job/42/output
200 OK
24
Long-‐running Request -‐ Long unhappy path -‐
REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstrac5ons and Simplifica5ons èFuture work
Delete output DELETE / job / 42 / output HTTP/1.1
HTTP/1.1 200 OK
Create job POST / job HTTP/1.1
Read results GET / job / 42 / output HTTP/1.1
HTTP/1.1 200 OK
HTTP/1.1 202 Accepted Loca5on: / job / 42
POST / job HTTP/1.1
GET / job / 42 / output HTTP/1.1
HTTP/1.1 200 OK
Poll GET / job / 42 HTTP/1.1
HTTP/1.1 200 OK
GET / job / 42 HTTP/1.1
HTTP/1.1 303 See Other Loca5on: / job / 42 / output
GET / job / 42 HTTP/1.1
HTTP/1.1 200 OK
Delete job DELETE / job / 42 HTTP/1.1
HTTP/1.1 200 OK
POST /job
202 AcceptedLocation: /job/42
DELETE /job/42/output
200 OK
DELETE /job/42
200 OKGET /job/42
200 OK 303 See OtherLocation: /job/42/output
GET /job/42/output
200 OK
Client
Server
POST /job
202 AcceptedLocation: /job/42
DELETE /job/42
GET /job/42
Client
Server
200 OK
Client
Server
Client
Server
200 OK
Client
Server 303 See OtherLocation: /job/42/output
Client
Server
GET /job/42/output
200 OK
Client
Server
200 OK
DELETE /job/42/output
Long-‐running Request -‐BPMN Choreography-‐
25 REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstrac5ons and Simplifica5ons èFuture work
POST /job
202 AcceptedLocation: /job/42
DELETE /job/42/output
200 OK
DELETE /job/42
200 OKGET /job/42
200 OK 303 See OtherLocation: /job/42/output
GET /job/42/output
200 OK
26
Long-‐running Request -‐Extended BPMN Choreography-‐
REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstrac5ons and Simplifica5ons èFuture work
Abstrac5ons and Simplifica5ons
27
Request
Response
Response 5xxResponse Hyperlink/ID; rel=...
Hyperlink/ID
Response Response 5xx
Hyperlink/ID
Hyperlink
Hyperlink/ID
Request Hyperlink/ID
Request Request
Response 5xx
Response Response 5xx
REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstracCons and SimplificaCons èFuture work
Request
Response
Response Hyperlink/ID; rel=...
Hyperlink/IDResponse
Hyperlink/IDResponse
Hyperlink
Hyperlink/ID
Request Hyperlink/ID
Request Request
2
Request
Response
Response 5xxResponse Hyperlink/ID; rel=...
Hyperlink/ID
Response Response 5xx
Hyperlink/ID
Hyperlink
Hyperlink/ID
Request Hyperlink/ID
Request Request
Response 5xx
Response Response 5xx
Abstrac5on – Server Error Response
28 REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstracCons and SimplificaCons èFuture work
Request
Response
Response Hyperlink/ID; rel=...
Hyperlink/IDResponse
Hyperlink/IDResponse
Hyperlink
Hyperlink/ID
Request Hyperlink/ID
Request Request
2
Request
Response
Response Hyperlink/ID; rel=...
Hyperlink/IDResponse
Hyperlink/IDResponse
Hyperlink
Hyperlink/ID
Request Hyperlink/ID
Request Request
Abstrac5on – Idempotent requests
29 REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstracCons and SimplificaCons èFuture work
Request
Response
Response Hyperlink/ID; rel=...
Hyperlink/IDResponse
Hyperlink/IDResponse
Hyperlink
Hyperlink/ID
Request Hyperlink/ID
Request Request
Request
Response
Response Hyperlink/ID; rel=...
Hyperlink/IDResponse
Hyperlink/IDResponse
Hyperlink
Hyperlink/ID
Request Hyperlink/ID
Request Request
Simplifica5on – End events
30 REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstracCons and SimplificaCons èFuture work
Request
Response
Response Hyperlink/ID; rel=...
Hyperlink/IDResponse
Hyperlink/IDResponse
Hyperlink
Hyperlink/ID
Request Hyperlink/ID
Request Request
Request
Response
Hyperlink/ID; rel=...
Hyperlink/ID
Response Hyperlink/IDResponse
Hyperlink
Hyperlink/ID
Request Hyperlink/ID
Request Request
Response
Simplifica5on -‐ Hyperlinks
31 REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstracCons and SimplificaCons èFuture work
Request
Response
Response 5xxResponse Hyperlink/ID; rel=...
Hyperlink/ID
Response Response 5xx
Hyperlink/ID
Hyperlink
Hyperlink/ID
Request Hyperlink/ID
Request Request
Response 5xx
Response Response 5xx
Request
Response
Hyperlink/ID; rel=...
Hyperlink/ID
Response Hyperlink/IDResponse
Hyperlink
Hyperlink/ID
Request Hyperlink/ID
Request Request
Response
Simplifica5ons and abstrac5ons summary
32 REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstracCons and SimplificaCons èFuture work
• Survey – Understandability – Ease of use
Future Work
• Conversa5on Paderns – Expressiveness – Collec5on – Reusability
33 REST èBPMN Choreography èExtended BPMN Choreography èExample Model èAbstrac5ons and Simplifica5ons èFuture work
Contact us at: [email protected]
[email protected] [email protected]
Contribute to our research by filling in the survey!!! hdp://reshulconversa5ons.limequery.com/index.php/215135/lang-‐en