Choreography, Orchestration, and Contracts Languages and Techniques for Service Composition

123
Gianluigi Zavattaro http://cs.unibo.it/~zavattar Department of Computer Science University of Bologna Choreography, Orchestration, and Contracts Languages and Techniques for Service Composition www.sensoria- ist.eu Based on joint work with: Mario Bravetti, Claudio Guidi, Ivan Lanese, Fabrizio Montesi

description

www.sensoria-ist.eu. Choreography, Orchestration, and Contracts Languages and Techniques for Service Composition. Gianluigi Zavattaro http://cs.unibo.it/~zavattar. Department of Computer Science University of Bologna. - PowerPoint PPT Presentation

Transcript of Choreography, Orchestration, and Contracts Languages and Techniques for Service Composition

Page 1: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Gianluigi Zavattarohttp://cs.unibo.it/~zavattar

Department of Computer Science

University of Bologna

Choreography, Orchestration, and ContractsLanguages and Techniques for Service Composition

www.sensoria-ist.eu

Based on joint work with: Mario Bravetti, Claudio Guidi, Ivan Lanese, Fabrizio Montesi

Page 2: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Plan of the Talk

An “open” world of services Service composition

Orchestration (bottom-up) Choreography (top-down)

Contract-based service discovery Output persistence Strong Compliance Message Queues

Conclusion and future work

Plan of the Talk

Page 3: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Plan of the Talk

An “open” world of services Service composition

Orchestration (bottom-up) Choreography (top-down)

Contract-based service discovery Output persistence Strong Compliance Message Queues

Conclusion and future work

Plan of the Talk

Page 4: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

An “open” world of services

Service Oriented Computing is used to design systems working in a heterogeneous and open environment where services: may appear and disappear may not be realiable/trustworthy can be located worldwide are subject to communication via network

that can cause delays, failures,…

Page 5: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Let us organize problems…

Not only the issue of inter-operability (computing across different platforms): Loose coupling: computing across

enterprise boundaries (when you use a service you must account for possible deviations from the expected behavior)

Open endedness: new services can enter, and old ones leave, while computation proceeds (you should dynamically re-build your system at run-time)

Page 6: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

An Example: Web Services

WSDL (interface definition language) UDDI (service discovery) SOAP (service invocation protocol)

SOAP

PUBLISHSERVICE

FIND SERVICE

-1--2-

-3-

Page 7: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Plan of the Talk

An “open” world of services Service composition

Orchestration (bottom-up) Choreography (top-down)

Contract-based service discovery Output persistency Strong Compliance Message Queues

Conclusion and future work

Plan of the Talk

Page 8: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Buying an electronic ticket

Page 9: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Buying an electronic ticket

Web search engines

Public advertisements

Friends or colleagues

Page 10: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Buying an electronic ticket

ticketingservice 1

ticketingservice 2

ticketingservice n

Page 11: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Buying an electronic ticket

ticketingservice 1

ticketingservice 2

ticketingservice n

request

Page 12: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Buying an electronic ticket

ticketingservice 1

ticketingservice 2

ticketingservice n

no ticket

Page 13: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Buying an electronic ticket

ticketingservice 1

ticketingservice 2

ticketingservice n

request

Page 14: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Buying an electronic ticket

ticketingservice 1

ticketingservice 2

ticketingservice n

no ticket

Page 15: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Buying an electronic ticket

ticketingservice 1

ticketingservice 2

ticketingservice n

request

Page 16: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Buying an electronic ticket

ticketingservice 1

ticketingservice 2

ticketingservice n

ticket

Page 17: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Buying an electronic ticket[using an orchestrator]

Page 18: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Buying an electronic ticket[using an orchestrator]

orchestrator

request

Page 19: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Buying an electronic ticket[using an orchestrator]

ticketingservice 1

ticketingservice 2

ticketingservice n

orchestrator

Page 20: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Buying an electronic ticket[using an orchestrator]

ticketingservice 1

ticketingservice 2

ticketingservice n

request

request

request

orchestrator

Page 21: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Buying an electronic ticket[using an orchestrator]

ticketingservice 1

ticketingservice 2

ticketingservice n

orchestrator

Page 22: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Buying an electronic ticket[using an orchestrator]

ticketingservice 1

ticketingservice 2

ticketingservice n

orchestrator

ticket

Page 23: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Buying an electronic ticket[using an orchestrator]

ticketingservice 1

ticketingservice 2

ticketingservice n

cancel

cancel

orchestrator

Page 24: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Buying an electronic ticket[using an orchestrator]

ticketingservice 1

ticketingservice 2

ticketingservice n

orchestrator

ticket

Page 25: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Orchestration

The orchestrator provides a new “meta”-service

Central point of coordination: it invokes several “sub”-services

The client of the “meta”-service interacts only with the orchestrator

Page 26: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Orchestration Languages

Languages used to program orchestrators XLANG:

proposed by Microsoft in 2001 WSFL:

proposed by IBM in 2001 WS-BPEL (formerly BPEL4WS):

proposed in 2002 by a consortium including IBM, Microsoft, SAP, BEA,…

Page 27: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

XLANG: based on -calculus

Start;Receive(req1,req2);( ( Invoke(req1)@srv1;

Reply(req1) ) |( Invoke(req2)@srv2; Reply(req2) ) );

End

Page 28: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

WSFL: based on Petri-nets

Receive(req1,req2)

Invoke(req1)@srv1 Invoke(req2)@srv2

Reply(req1) Reply(req2)

Page 29: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

WSFL: based on Petri-nets

Receive(req1,req2)

Invoke(req1)@srv1 Invoke(req2)@srv2

Reply(req1) Reply(req2)

Page 30: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

WSFL: based on Petri-nets

Receive(req1,req2)

Invoke(req1)@srv1 Invoke(req2)@srv2

Reply(req1) Reply(req2)

Page 31: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

WSFL: based on Petri-nets

Receive(req1,req2)

Invoke(req1)@srv1 Invoke(req2)@srv2

Reply(req1) Reply(req2)

Page 32: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

WSFL: based on Petri-nets

Receive(req1,req2)

Invoke(req1)@srv1 Invoke(req2)@srv2

Reply(req1) Reply(req2)

Page 33: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

WSFL: based on Petri-nets

Receive(req1,req2)

Invoke(req1)@srv1 Invoke(req2)@srv2

Reply(req1) Reply(req2)

Page 34: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

WSFL: based on Petri-nets

Receive(req1,req2)

Invoke(req1)@srv1 Invoke(req2)@srv2

Reply(req1) Reply(req2)

Page 35: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

WSFL: based on Petri-nets

Receive(req1,req2)

Invoke(req1)@srv1 Invoke(req2)@srv2

Reply(req1) Reply(req2)

Page 36: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

WSFL: based on Petri-nets

Receive(req1,req2)

Invoke(req1)@srv1 Invoke(req2)@srv2

Reply(req1) Reply(req2)

Page 37: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

WSFL: based on Petri-nets

Receive(req1,req2)

Invoke(req1)@srv1 Invoke(req2)@srv2

Reply(req1) Reply(req2)

Page 38: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

WSFL: based on Petri-nets

Receive(req1,req2)

Invoke(req1)@srv1 Invoke(req2)@srv2

Reply(req1) Reply(req2)

Page 39: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

WSFL: based on Petri-nets

Receive(req1,req2)

Invoke(req1)@srv1 Invoke(req2)@srv2

Reply(req1) Reply(req2)

Page 40: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

WSFL: based on Petri-nets

Receive(req1,req2)

Invoke(req1)@srv1 Invoke(req2)@srv2

Reply(req1) Reply(req2)

Page 41: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

WS-BPEL: join XLANG and WSFL

Start;Receive(req1,req2);( ( Invoke(req1)@srv1;

Send(intLink); Reply(req1) ) |( Invoke(req2)@srv2; Recv(intLink); Reply(req2) ) );

End

Page 42: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

WS-BPEL

Join the WSFL and XLANG approaches Combine Petri-nets and -calculus

Add mechanisms for event, fault, termination and compensation handling Timed events Long-running transactions

Page 43: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Plan of the Talk

An “open” world of services Service composition

Orchestration (bottom-up) Choreography (top-down)

Contract-based service discovery Output persistence Strong Compliance Message Queues

Conclusion and future work

Plan of the Talk

Page 44: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Choreography Languages

Specification language (not executable)

No central point of coordination The composed services interact

reciprocally WS-CDL: proposed by W3C in 2004 BPEL4Chor: recently proposed by

researchers involved in WS-BPEL

Page 45: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Web Service Choreography Description Language

Describe the interaction among the combined services from a top abstract view

Choreography (e.g. WS-CDL)

Top abstract view of whole system: each action is a communication involving two of its participants

Orchestration (e.g. WS-BPEL)

One Party detailed view of the system that orchestrates a part of it by sending (to other parties) & receiving messages

Page 46: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Similar to Specification of Chryptographic Protocols

Protocol for the request to a trusted entity of the creation of a session key:

Alice Trent: Alice, BobTrent Alice: {KAB}KA

, {KAB}KB

Alice Bob: {KAB}KB

Page 47: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Similar to UML Sequence Diagrams

Page 48: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

WS-CDL Global view of service interactions

Buyer

Seller

Bank

Page 49: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

WS-CDL Global view of service interactions

Buyer

SellerRequest

Bank

Page 50: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

WS-CDL Global view of service interactions

Buyer

Seller

PayDescr

RequestOffer

Bank

Page 51: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

WS-CDL Global view of service interactions

Buyer

Seller

PayDescr

RequestOffer

Bank

Payment

Page 52: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

WS-CDL Global view of service interactions

Buyer

Seller

PayDescr

RequestOffer

Bank

PaymentConfirm

Receipt

Page 53: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

WS-CDL

RequestBuyerSeller ;

( OfferSellerBuyer |

PayDescrSellerBank ) ;

PaymentBuyerBank ;

( ConfirmBankSeller |

ReceiptBankBuyer )

Page 54: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

RequestBuyerSeller ;

( OfferSellerBuyer |

PayDescrSellerBank ) ;

PaymentBuyerBank ;

( ConfirmBankSeller |

ReceiptBankBuyer )

WS-CDL

Page 55: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

RequestBuyerSeller ;

( OfferSellerBuyer |

PayDescrSellerBank ) ;

PaymentBuyerBank ;

( ConfirmBankSeller |

ReceiptBankBuyer )

WS-CDL

Page 56: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

RequestBuyerSeller ;

( OfferSellerBuyer |

PayDescrSellerBank ) ;

PaymentBuyerBank ;

( ConfirmBankSeller |

ReceiptBankBuyer )

WS-CDL

Page 57: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

RequestBuyerSeller ;

( OfferSellerBuyer |

PayDescrSellerBank ) ;

PaymentBuyerBank ;

( ConfirmBankSeller |

ReceiptBankBuyer )

WS-CDL

Page 58: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

BPEL4Chor

The WS-BPEL approach to choreography: Parallel composition of abstract WS-

BPEL descriptions Abstract WS-BPEL: description of the

externally observable message passing behaviour (opacifies internal details)

Page 59: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Buyer-Seller-Bank example

Barcelona - 3.11.2008Choreography, Orchestration, and Contracts

Buyer

Seller

PayDescr

RequestOffer

Bank

PaymentConfirm

Receipt

Page 60: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Projection of the Choreography on the Single Participants

Buyer: Invoke(Request)@Seller;Receive(Offer); Invoke(Payment)@Bank;Receive(Receipt)

Seller: Receive(Request); (Invoke(Offer)@Buyer | Invoke(PayDescr)@Bank); Receive(Confirm)

Bank: Receive(PayDescr);Receive(Payment); (Invoke(Receipt)@Buyer | Invoke(Confirm)@Seller)

Page 61: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

WS-CDL vs. BPEL4Chor

Can we always project a WS-CDL specification in an equivalent BPEL4Chor one?

Which kind of equivalences are preserved?

Page 62: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

A Formal Model for WS-CDL

A global choreography language:H ::= ars | 1 | 0 |

H;H | H+H | H|H | H*

Page 63: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

A Formal Model for WS-CDL

A global choreography language:H ::= ars | 1 | 0 |

H;H | H+H | H|H | H*r invokes the

operation a of s

Successful termination

Unsuccessful termination

Page 64: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

A Formal Model for WS-CDL

A global choreography language:H ::= ars | 1 | 0 |

H;H | H+H | H|H | H*

Choice

Sequence

Parallel Repetition

Page 65: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Structured Operational Semantics

Page 66: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

A Formal Model for BPEL4Chor

A local choreography language:P ::= a | ar | 1 | 0 |

P;P | P+P | P|P | P*S ::= [P]r | S|S

Page 67: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

A Formal Model for BPEL4Chor

A local choreography language:P ::= a | ar | 1 | 0 |

P;P | P+P | P|P | P*S ::= [P]r | S|S

receive on a

Successful termination

Unsuccessful termination

invoke a at r

Page 68: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

A Formal Model for BPEL4Chor

Choice

Sequence

Parallel Repetition

A local choreography language:P ::= a | ar | 1 | 0 |

P;P | P+P | P|P | P*S ::= [P]r | S|S

Page 69: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

A Formal Model for BPEL4Chor

A local choreography language:P ::= a | ar | 1 | 0 |

P;P | P+P | P|P | P*S ::= [P]r | S|S

Behaviour of participant r

Parallel compositionof participants

Page 70: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

The “canonical” projection

Projection [[ H ]]t of choreography H to participant t

as if t=r

[[ ars ]]t = a if t=s1 otherwise

[[H;H’]]t=[[H]]t ; [[H’]]t [[H|H’]]t=[[H]]t | [[H’]]t

[[H+H’]]t=[[H]]t + [[H’]]t

[[H*]]t=[[H]]t*

Page 71: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Example

Consider the global choreography: ars ; btu

Projection: [ as ;1]r | [ a;1 ]s | [ 1;bu ]t | [ 1;b ]u

Are the two choreographies equivalent? NO But, if r=t…. YES

[ as; bu ]r | [ a;1 ]s | [ 1;b ]u

Page 72: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Asynchronous communication

Reconsider the example assuming asynchronous communication

[ as; bu ]r | [ a ]s | [ b ]u

Communication on a starts before communication on b but could finish after

What we should observe? Send, Receive, both, …?

Page 73: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

A lattice of possible observation criteria

Disjoint

Sender Receiver

Sender-receiver

Synchronous

Page 74: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

A lattice of possible observation criteria

Disjoint

Sender Receiver

Sender-receiver

Synchronous

Assuming synchronous communication: observe either send or receive

Page 75: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

A lattice of possible observation criteria

Disjoint

Sender Receiver

Sender-receiver

Synchronous

Assuming asynchronous communication: observe send

Page 76: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

A lattice of possible observation criteria

Disjoint

Sender Receiver

Sender-receiver

Synchronous

Assuming asynchronous communication: observe receive

Page 77: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

A lattice of possible observation criteria

Disjoint

Sender Receiver

Sender-receiver

Synchronous

Assuming asynchronous communication: observe send and observe receive

Page 78: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

A lattice of possible observation criteria

Disjoint

Sender Receiver

Sender-receiver

Synchronous

Assuming asynchronous communication: observe send and receive (no overlap)

Page 79: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

What about the previous example?

Reconsider the example ars ; bru

[ as; bu ]r | [ a ]s | [ b ]u

OK: for synchronous and sender NO: for receiver, sender-receiver,

disjoint

Page 80: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Main results

For each observation criterion: Sufficient conditions (connectedness,

unique point of choice, and causality safe) that guarantee that a global choreography is equivalent to the projected one

Page 81: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Unique point of choice

In a choice H+H’ The sender of the initial transitions in H and

in H’ is always the same The roles in H and in H’ are the same

Example: if we drop the second condition (ars + brt ); c st

[ ( as+bt );1]r | [ (a+1);ct ]s | [ (1+b);c ]t

Page 82: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Which equivalence between global and local choreographies?

Synchronous bisimilarity: global transitions are matched by synchronous local transitions

Sender bisimilarity: global transitions are matched by local sends, local receives are abstracted away

weak w.r.t. local receive transitions Receiver bisimilarity: global transitions are matched

by local receives, global sends are abstracted away weak w.r.t. local send transitions

Disjoint bisimilarity: a global transition is matched by subsequent send and receive local transitions

Page 83: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Example: Receiver bisimilarity

Page 84: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Example: Receiver bisimilarity

Global choreography: ars ; bts

Local choreography: [ as ]r | [ a;b ]s | [ bs ]t

The two systems are sender bisimilar

Page 85: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Plan of the Talk

An “open” world of services Service composition

Orchestration (bottom-up) Choreography (top-down)

Contract-based service discovery Output persistence Strong Compliance Message Queues

Conclusion and future work

Plan of the Talk

Page 86: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Contracts [FHRR04][CCLP06]

Contract: service “behavioural interface” that describes the signature of the

provided operations the correct sequences

of invoke and receive

Contract:abstract service

description

Service

public registry

Page 87: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Contract Compliance Verification of correctness of service

composition based on their contracts: successful interaction i.e. no deadlock / termination reached

Contract:abstract service

description

Service

…Contract:

abstract service description

Service …

public registry public registry

Reciprocal invocations

Page 88: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Service Compliance: Formally

Services are compliant if the following holds for their composition P:

P --->* P’ implies that there exist P’’ and P’’’ s.t. P’ --->* P’’ ---> P’’’

i.e. every computation can be extended to reach successful completion of all services

τ

√τ

Page 89: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Example: compliant services

The following pairs of services are compliant: C1 = a+b+c C2 = a + b C1 = a;b C2 = a | b C1 = (a; b )* C2 = a;

( b;a )*;b

Page 90: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Choreography

Directly Checking Conformance w.r.t. Choreography

Contract

public registry

Contract

public registry

Service Service …Reciprocal invocations

is conformant for participant 1 to

is conformant for participant n tocompliance

guaranteed by conformance

Page 91: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Choreography

Compliance-Preserving Contract Refinement !

Contract

public registry

Contract

public registry

Service Service …Reciprocal invocations

Contract Part. 1 Contract Part. n…refines refines

compliance preserved by refinement

compliant by construction

projection projection

Page 92: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Choreography

First Relation: Contract Refinement

Contract

public registry

Contract

public registry

Service Service …Reciprocal invocations

Contract Part. 1 Contract Part. n…refines refines

compliance preserved by refinement

compliant by construction

Page 93: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Formally: Subcontract Preorder

C

sub-contracts

of C

subcontractpreorder

Preorder ≤ between contracts C: C’ ≤ C means C’ is a subcontract

of C

Page 94: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Definition of Preorder Induced from Independent Refinement

C1 C2 Cn

Given a set of compliant contracts

is a set of compliant contracts

subcontractpreorder

sub-contracts

of C2 …sub-contracts

of C1 sub-contracts

of Cn

C’1 C’2 C’n…

Page 95: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

No maximal subcontract preorder … in general

Consider the system:[ a ] | [ a ]

we could have one preorder ≤1 for which

a + c.0 ≤1 a a + c.0 ≤1 a

and one preorder ≤2 for which

a + c.0 ≤2 a a + c.0 ≤2 a

but no subcontract preorder could havea + c.0 ≤ a a + c.0 ≤ a

Consequence: no independent refinement!

Page 96: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Plan of the Talk

An “open” world of services Service composition

Orchestration (bottom-up) Choreography (top-down)

Contract-based service discovery Output persistence Strong Compliance Message Queues

Conclusion and future work

Plan of the Talk

Page 97: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Maximal pre-order

It exists changing some assumptions: Limiting the considered services

(output persistence) Strengthening the notion of

compliance (strong compliance) Moving to asynchronous

communication(e.g. via message queues)

Page 98: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Output persistence

Output persistence means that given a process state P: If P has an output action on a and

P-->P’ with α different from output on a, then also P’ has an output on a

This holds, for instance, in WS-BPEL Outputs cannot resolve the pick operator

for external choices (the decision to execute outputs is taken internally)

α

Page 99: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Example

Given the choreography:RequestAliceBob; (AcceptBobAlice +

RejectBobAlice)

The following services can be retrieved:[τ;RequestBob;(Accept+Reject)]Alice | [Request;(τ;AcceptAlice+τ;RejectAlice)]Bob

Page 100: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Example

Given the choreography:RequestAliceBob; (AcceptBobAlice +

RejectBobAlice)

The following services can be retrieved:[τ;RequestBob;(Accept+Reject)]Alice | [Request;(τ;AcceptAlice+τ;RejectAlice)]Bob

[τ;RequestBob;(Accept+Reject+Retry)]Alice | [Request;(τ;AcceptAlice+τ;RejectAlice)]Bob

Page 101: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Example

Given the choreography:RequestAliceBob; (AcceptBobAlice + RejectBobAlice)

The following services can be retrieved:[τ;RequestBob;(Accept+Reject)]Alice | [Request;(τ;AcceptAlice+τ;RejectAlice)]Bob

[τ;RequestBob;(Accept+Reject+Retry)]Alice | [Request;(τ;AcceptAlice+τ;RejectAlice)]Bob

[τ;RequestBob;(Accept+Reject+Retry)]Alice | [Request;τ;AcceptAlice]Bob

Page 102: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

“Standard” Contract Compliance

A second example: S1: invoke(a);invoke(b) S2: receive(a);invoke(c) S3: receive(c);receive(b)

S1

S2

S3

Page 103: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

“Standard” Contract Compliance

A second example: S1: invoke(a);invoke(b) S2: receive(a);invoke(c) S3: receive(c);receive(b)

S1

S2

S3

Page 104: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

“Standard” Contract Compliance

A second example: S1: invoke(a);invoke(b) S2: receive(a);invoke(c) S3: receive(c);receive(b)

S1

S2

S3

Page 105: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

“Standard” Contract Compliance

A second example: S1: invoke(a);invoke(b) S2: receive(a);invoke(c) S3: receive(c);receive(b)

S1

S2

S3

Page 106: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

“Standard” Contract Compliance

A second example: S1: (invoke(a);receive(b))* S2:

(receive(a);invoke(b))*;receive(c) S3: invoke(c)S1

S2

S3

Page 107: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

“Standard” Contract Compliance

A second example: S1: (invoke(a);receive(b))* S2:

(receive(a);invoke(b))*;receive(c) S3: invoke(c)S1

S2

S3

But S3 could wait indefinitely to complete its invocation !!

Page 108: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

“Standard” Contract Compliance

A second example: S1: (invoke(a);receive(b))* S2:

(receive(a);invoke(b))*;receive(c) S3: invoke(c)S1

S2

S3

But S3 could wait indefinitely to complete its invocation !!

Strong compliance requires the receptor to be ready

Page 109: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Example: strong compliant services

The following pairs of services are strong compliant: C1 = a+b+c C2 = a + b C1 = a;b C2 = a | b C1 = (a; b )* C2 = a;

( b;a )*;b

Page 110: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Example: strong compliant services

The following pairs of services are strong compliant: C1 = a+b+c C2 = a + b C1 = a;b C2 = a | b C1 = (a; b )* C2 = a;

( b;a )*;b

Page 111: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

“Strong” refinement

It allows also refinement on names already in the interface: Receive(a);(Receive(b)+Receive(a)) ≤ Receive(a);Receive(b)

Page 112: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Summary of Results Refinement with knowledge about other initial

contracts limited to I/O actions (enough to guarantee that refinements that extend the interface are included)

“normal” compliance: Uncostrained contracts: maximal relation does not exist Contracts where outputs are internally chosen (output persistence):

maximal relation exists and “I” knowledge is irrelevant Output persistent contracts where outputs are directed to a location:

maximal relation exists and “I/O” knowledge is irrelevant strong compliance:

Uncostrained contracts (where output are directed to a location):maximal relation exists and “I/O” knowledge is irrelevant

queue-based compliance: Uncostrained contracts (where output are directed to a location):

maximal relation exists and “I/O” knowledge is irrelevant

Page 113: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Plan of the Talk

An “open” world of services Service composition

Orchestration (bottom-up) Choreography (top-down)

Contract-based service discovery Output persistence Strong Compliance Message Queues

Conclusion and future work

Plan of the Talk

Page 114: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Future work

Apply contract theory to real orchestration languages JOLIE: Java Orchestration Language

Interpreter Engine (formal semantics defined by the process calculus SOCK)

Contracts with operators for process interruption and compensation The contract language becomes partially

undecidable

Page 115: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Related work

Carbone, Honda, Yoshida Global and End-point calculus similar

to our WS-CDL and BPEL4Chor Only some of our observation criteria

are considered Stronger conditions for projection

Page 116: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Related work

Fu, Bultan, Su Service systems with message

queues similar to ours Observe the send event as in our

sender observation criterion No refinement

Page 117: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Related work

Padovani et al. Contracts described with an ad-hoc

transition system (reminiscent of acceptance tree)

The absence of maximal subcontract relation solved either with explicit interfaces of filters (cut the additional actions of the refinements)

Page 118: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

Related work

van der Aalst et al. Contracts described with open workflow

nets (similar to petri nets) Same notion of compliance Same definition of subcontract as maximal

refinement that preserves compliance Characterization of the refinement for

processes without “loops” (make the system infinite due to message queues)

Page 119: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

References N. Busi, R. Gorrieri, C. Guidi, R. Lucchi, and G. Zavattaro. Choreography and

Orchestration Conformance for System Design. In Coordination’06. I. Lanese, C. Guidi, F. Montesi, and G. Zavattaro. Bridging the Gap Between

Interaction- and Process-oriented Choreographies. In SEFM’08. M. Bravetti and G. Zavattaro. Contract based Multi-party Service

Composition. In FSEN’07. (full version in Fundamenta Informaticae) M. Bravetti and G. Zavattaro. Towards a Unifying Theory for Choreography

Conformance and Contract Compliance. In SC’07. M. Bravetti and G. Zavattaro. A Theory for Strong Service Compliance. In

Coordination’07. (full version in MSCS) M. Bravetti and G. Zavattaro. Contract Compliance and Choreography

Conformance in the presence of Message Queues.In WS-FM’08 C. Guidi, R. Lucchi, R. Gorrieri, N. Busi, and G. Zavattaro. SOCK: a Calculus for

Service Oriented Computing. In ICSOC’06. F. Montesi, C. Guidi, and G. Zavattaro. Orchestrating Services in JOLIE. In

ECOWS’07. C. Guidi, I. Lanese, F. Montesi, and G. Zavattaro. On the Interplay Between

Fault Handling and Request-response Service Invocations. In ACSD’08. C. Guidi, F. Montesi, I. Lanese, and G. Zavattaro. Dynamic Fault-handling for

Service Oriented Applications. In ECOWS’08. M. Bravetti and G. Zavattaro. On the Expressive Power of Process

Interruption and Compensation. In WS-FM’08

Page 120: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

References N. Busi, R. Gorrieri, C. Guidi, R. Lucchi, and G. Zavattaro. Choreography

and Orchestration Conformance for System Design. In Coordination’06. I. Lanese, C. Guidi, F. Montesi, and G. Zavattaro. Bridging the Gap

Between Interaction- and Process-oriented Choreographies. In SEFM’08.

M. Bravetti and G. Zavattaro. Contract based Multi-party Service Composition. In FSEN’07. (full version in Fundamenta Informaticae)

M. Bravetti and G. Zavattaro. Towards a Unifying Theory for Choreography Conformance and Contract Compliance. In SC’07.

M. Bravetti and G. Zavattaro. A Theory for Strong Service Compliance. In Coordination’07. (full version in MSCS)

M. Bravetti and G. Zavattaro. Contract Compliance and Choreography Conformance in the presence of Message Queues.In WS-FM’08

C. Guidi, R. Lucchi, R. Gorrieri, N. Busi, and G. Zavattaro. SOCK: a Calculus for Service Oriented Computing. In ICSOC’06.

F. Montesi, C. Guidi, and G. Zavattaro. Orchestrating Services in JOLIE. In ECOWS’07.

C. Guidi, I. Lanese, F. Montesi, and G. Zavattaro. On the Interplay Between Fault Handling and Request-response Service Invocations. In ACSD’08.

C. Guidi, F. Montesi, I. Lanese, and G. Zavattaro. Dynamic Fault-handling for Service Oriented Applications. In ECOWS’08.

M. Bravetti and G. Zavattaro. On the Expressive Power of Process Interruption and Compensation. In WS-FM’08

Page 121: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

References N. Busi, R. Gorrieri, C. Guidi, R. Lucchi, and G. Zavattaro. Choreography and

Orchestration Conformance for System Design. In Coordination’06. I. Lanese, C. Guidi, F. Montesi, and G. Zavattaro. Bridging the Gap Between

Interaction- and Process-oriented Choreographies. In SEFM’08. M. Bravetti and G. Zavattaro. Contract based Multi-party Service

Composition. In FSEN’07. (full version in Fundamenta Informaticae) M. Bravetti and G. Zavattaro. Towards a Unifying Theory for

Choreography Conformance and Contract Compliance. In SC’07. M. Bravetti and G. Zavattaro. A Theory for Strong Service

Compliance. In Coordination’07. (full version in MSCS) M. Bravetti and G. Zavattaro. Contract Compliance and Choreography

Conformance in the presence of Message Queues.In WS-FM’08 C. Guidi, R. Lucchi, R. Gorrieri, N. Busi, and G. Zavattaro. SOCK: a Calculus for

Service Oriented Computing. In ICSOC’06. F. Montesi, C. Guidi, and G. Zavattaro. Orchestrating Services in JOLIE. In

ECOWS’07. C. Guidi, I. Lanese, F. Montesi, and G. Zavattaro. On the Interplay Between

Fault Handling and Request-response Service Invocations. In ACSD’08. C. Guidi, F. Montesi, I. Lanese, and G. Zavattaro. Dynamic Fault-handling for

Service Oriented Applications. In ECOWS’08. M. Bravetti and G. Zavattaro. On the Expressive Power of Process Interruption

and Compensation. In WS-FM’08

Page 122: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

References N. Busi, R. Gorrieri, C. Guidi, R. Lucchi, and G. Zavattaro. Choreography and

Orchestration Conformance for System Design. In Coordination’06. I. Lanese, C. Guidi, F. Montesi, and G. Zavattaro. Bridging the Gap Between

Interaction- and Process-oriented Choreographies. In SEFM’08. M. Bravetti and G. Zavattaro. Contract based Multi-party Service Composition.

In FSEN’07. (full version to appear in Fundamenta Informaticae) M. Bravetti and G. Zavattaro. Towards a Unifying Theory for Choreography

Conformance and Contract Compliance. In SC’07. M. Bravetti and G. Zavattaro. A Theory for Strong Service Compliance. In

Coordination’07. (full version to appear in MSCS) M. Bravetti and G. Zavattaro. Contract Compliance and Choreography

Conformance in the presence of Message Queues.In WS-FM’08 C. Guidi, R. Lucchi, R. Gorrieri, N. Busi, and G. Zavattaro. SOCK: a

Calculus for Service Oriented Computing. In ICSOC’06. F. Montesi, C. Guidi, and G. Zavattaro. Orchestrating Services in

JOLIE. In ECOWS’07. C. Guidi, I. Lanese, F. Montesi, and G. Zavattaro. On the Interplay Between

Fault Handling and Request-response Service Invocations. In ACSD’08. C. Guidi, F. Montesi, I. Lanese, and G. Zavattaro. Dynamic Fault-handling for

Service Oriented Applications. In ECOWS’08. M. Bravetti and G. Zavattaro. On the Expressive Power of Process Interruption

and Compensation. In WS-FM’08

Page 123: Choreography, Orchestration,  and Contracts Languages and Techniques for Service Composition

References N. Busi, R. Gorrieri, C. Guidi, R. Lucchi, and G. Zavattaro. Choreography and

Orchestration Conformance for System Design. In Coordination’06. I. Lanese, C. Guidi, F. Montesi, and G. Zavattaro. Bridging the Gap Between

Interaction- and Process-oriented Choreographies. In SEFM’08. M. Bravetti and G. Zavattaro. Contract based Multi-party Service Composition. In

FSEN’07. (full version to appear in Fundamenta Informaticae) M. Bravetti and G. Zavattaro. Towards a Unifying Theory for Choreography

Conformance and Contract Compliance. In SC’07. M. Bravetti and G. Zavattaro. A Theory for Strong Service Compliance. In

Coordination’07. (full version to appear in MSCS) M. Bravetti and G. Zavattaro. Contract Compliance and Choreography Conformance

in the presence of Message Queues.In WS-FM’08 C. Guidi, R. Lucchi, R. Gorrieri, N. Busi, and G. Zavattaro. SOCK: a Calculus for

Service Oriented Computing. In ICSOC’06. F. Montesi, C. Guidi, and G. Zavattaro. Orchestrating Services in JOLIE. In

ECOWS’07. C. Guidi, I. Lanese, F. Montesi, and G. Zavattaro. On the Interplay Between

Fault Handling and Request-response Service Invocations. In ACSD’08. C. Guidi, F. Montesi, I. Lanese, and G. Zavattaro. Dynamic Fault-handling

for Service Oriented Applications. In ECOWS’08. M. Bravetti and G. Zavattaro. On the Expressive Power of Process

Interruption and Compensation. In WS-FM’08