WS-CAF in a Nutshell Mark Little, Arjuna Technologies Ltd What is - - PowerPoint PPT Presentation

ws caf in a nutshell
SMART_READER_LITE
LIVE PREVIEW

WS-CAF in a Nutshell Mark Little, Arjuna Technologies Ltd What is - - PowerPoint PPT Presentation

WS-CAF in a Nutshell Mark Little, Arjuna Technologies Ltd What is WS-CAF? Collection of 3 specifications Designed to be used independently or together 18+ months of effort Based on implementation and user feedback


slide-1
SLIDE 1

WS-CAF in a Nutshell

Mark Little, Arjuna Technologies Ltd

slide-2
SLIDE 2

WS-CAF face-to-face, Boston 3rd to 4th December 2003

What is WS-CAF?

  • Collection of 3 specifications

– Designed to be used independently or together

  • 18+ months of effort
  • Based on implementation and user feedback

– Extended transactions

  • OMG Activity Service

– OASIS BTP experiences – Web services

  • Define an architecture
slide-3
SLIDE 3

WS-CAF face-to-face, Boston 3rd to 4th December 2003

What are the specifications?

  • WS-Context

– Context service(!)

  • WS-Coordination Framework

– Framework for pluggable coordination protocols

  • WS-Transaction Management

– Three transaction models for Web services

  • Interoperability with existing implementations is important

– Live document

  • Updated with new models as and when required
slide-4
SLIDE 4

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Hierarchy

slide-5
SLIDE 5

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Interaction patterns

  • All specifications mandate XML but not

binding

– Can use request/response or one-ways

  • One-way messages are the default

– Best suited to the asynchronous, loosely- coupled nature of Web services

  • Tolerate faults (outages)
  • Allow for redirections
slide-6
SLIDE 6

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Addressing

  • Used own “home-brew” version of

addressing

– Basically URI and additional information

  • Better to use something that is a standard

– Continue to use own in interim

slide-7
SLIDE 7

WS-CAF face-to-face, Boston 3rd to 4th December 2003

What is a context?

  • A way of doing correlation of messages
  • For example

– Web browser cookie – Single-session sign-on – Transactions – Database session identifier

slide-8
SLIDE 8

WS-CAF face-to-face, Boston 3rd to 4th December 2003

WS-Context

  • Context and “life-cycle” service

– Most fundamental aspect of WS architecture

  • Defines notion of an activity

– Unit of work

  • Precise definition left up to higher level services/users

– Basic context associated with activity

  • Context Service maintains context for each

activity

– May be co-located or separate service

slide-9
SLIDE 9

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Goals

  • To provide a basic context service for Web

services

– Lots of different services (and specifications!) need one

  • Better to standardise early!
  • Provide ability to do correlation at a

minimum

– No augmentation of framework required to use it

slide-10
SLIDE 10

WS-CAF face-to-face, Boston 3rd to 4th December 2003

What are activities?

  • Scoping for arbitrary units of work

– Created, made to run and then terminated

  • Two termination states

– Success – Failure

– Boundary of a context

  • Can do anything in an activity

– use the default context however services want

  • Default context is essentially a UID (URI)

– Just for correlation

slide-11
SLIDE 11

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Activity example

slide-12
SLIDE 12

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Context specifics

  • Context is a first-class element

– URI which may represent a web resource

  • Basic context contains

– Unique activity id for each activity – Timeout period (lifetime of activity)

  • May be augmented:

– Dynamically as remote invocations progress – Before application invocation occurs

  • By calling Activity Lifecycle Services (ALS)
slide-13
SLIDE 13

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Requirements for a context service

  • Service definition for start and end of

activity

– Context bound to activity

  • Enable services to receive contexts

– Propagation by reference or value

  • Contexts should be first-class entities (services)
  • Enable services to augment contexts

– Coordination, security, transactions, …

slide-14
SLIDE 14

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Propagation

  • Context information propagated in SOAP

header

– Minimally defined by a URI

  • In which case this is a service reference
  • Context definer specifies whether it must

be understood by receiver

– MustPropagate

slide-15
SLIDE 15

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Context manager

slide-16
SLIDE 16

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Categories of Services

  • Application Service (AS)

– Sends and receives contexts

  • Activity Lifecycle Service (ALS)

– Context augmentation Service

  • Used to modify the context

– E.g., security service

– Trigger actions when activity starts/ends – One Service, but perhaps two?

slide-17
SLIDE 17

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Example

slide-18
SLIDE 18

WS-CAF face-to-face, Boston 3rd to 4th December 2003

ALS

  • Services may register to participate in lifecycle of

activity

– Informed when begun and when ending

  • Are given a chance to augment context before

application invocation

– Not called prior to each invocation, only on lifecycle “events”

  • Example

– Coordination – Security

slide-19
SLIDE 19

WS-CAF face-to-face, Boston 3rd to 4th December 2003

ALS example

A p p lic a t io n

C o o r d in a t io n S e r v ic e , e . g . , T r a n s a c t io n

C T X S e r v ic e B a s ic c o n t e x t + t x A c t iv it y

slide-20
SLIDE 20

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Context schema

  • <xs:complexType name="ContextType">
  • <xs:sequence>
  • <xs:element name="context-identifier" type="xs:anyURI"/>
  • <xs:element name="activity-service" type="xs:anyURI" minOccurs="0"/>
  • <xs:element name="type" type="xs:anyURI" minOccurs="0"/>
  • <xs:element name="activity-list" minOccurs="0">
  • <xs:complexType>
  • <xs:sequence>
  • <xs:element name="service" type="xs:anyURI" minOccurs="0"

maxOccurs="unbounded"/>

  • </xs:sequence>
  • <xs:attribute name="mustUnderstand" type="xs:boolean" use="optional"

default="false"/>

  • <xs:attribute name="mustPropagate" type="xs:boolean" use="optional"

default="false"/>

  • </xs:complexType>
  • </xs:element>
  • <xs:element name="child-contexts" minOccurs="0">
  • <xs:complexType>
  • <xs:sequence>
  • <xs:element name="child-context" type="tns:ContextType"

maxOccurs="unbounded"/>

  • </xs:sequence>
  • </xs:complexType>
  • </xs:element>
  • <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
  • </xs:sequence>
  • <xs:attribute name="timeout" type="xs:int" use="optional"/>
  • </xs:complexType>
slide-21
SLIDE 21

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Contains

  • Context identifier (URI)
  • Context service URI

– activity-service (rename)

  • An identifier that indicates the type of the activity
  • An list of the services currently participating in the

activity

– participating-services

  • A list of child activities

– child-contexts

  • A timeout value
  • Extensibility element

– ALS information

slide-22
SLIDE 22

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Summary

  • Context is a building block
  • Basic context should be useful in its own

right

– Correlation

  • Should work with existing contexts and

services

– WS-BPEL – Security

slide-23
SLIDE 23

WS-CAF face-to-face, Boston 3rd to 4th December 2003

WS-CF

  • Coordination is more fundamental than

transactions

– Security – Replication – Transactions – Caching – Process-flow

slide-24
SLIDE 24

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Goals

  • Provide a general framework for coordination

protocols

– Existing implementations to be plugged in – New implementations can be supported

  • Defines coordinator and participant relationships
  • Work with WS-Context

– Define an appropriate ALS – Augment context

  • Scope of activity becomes scope of coordination

boundary

slide-25
SLIDE 25

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Architecture

WSCF

Coordinator Participant Coordination protocol messages Participants XML Message Set Coordination Framework Coordination Framework Application WebService Coordination Service SOAP SOAP WSDL for Coordination Service and Activity Service to communicate. WSDL XML - Signal Message Definition Context (XML) included on application flow or service flows High Level Service High Level Service Demarcation API

slide-26
SLIDE 26

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Coordination protocol

  • Defined by the message interactions

between coordinator and participant

  • WS-CF is protocol neutral
  • Protocols uniquely identified

– URI – Something else has to manage/impose the semantic meaning of a specific protocol identifier

slide-27
SLIDE 27

WS-CAF face-to-face, Boston 3rd to 4th December 2003

What does it define?

  • The structure of the augmented context

– Coordination service must register with Activity Service as an ALS

  • Coordinator and participants

– Basic interaction protocol – Not mandated

  • Can plug in other implementations
  • Must be able to leverage existing

infrastructure

slide-28
SLIDE 28

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Mandatory

  • The Coordination ALS

– So that the context can be augmented

  • Registration service for participants
  • Implementation specific data
  • Context service informs ALS at start/end
  • f activity

– Coordinator-to-participant protocol is not defined at all

slide-29
SLIDE 29

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Context type

<xs:complexType name="ContextType"> <xs:complexContent> <xs:extension base="wsctx:ContextType"> <xs:sequence> <xs:element name="protocol-reference" type="tns:ProtocolReferenceType"/> <xs:element name="coordinator-reference" type="tns:CoordinatorReferenceType" maxOccurs="unbounded"/> <xs:any namespace="##any" processContents="lax" maxOccurs="unbounded"/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType>

slide-30
SLIDE 30

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Optional

  • The Coordinator Service

– Provides a participant registration endpoint – Coordination status and identity – Can be driven at arbitrary points during activity

  • Participant

– The operations performed as part of coordination sequence processing

  • Works in terms of AssertionTypes

– status

slide-31
SLIDE 31

WS-CAF face-to-face, Boston 3rd to 4th December 2003

WS-Context plug-in

Context Service ALS members

Coordination Service ALS Context Service JTA coordinator

begin/end of activity

Application Web Service Participant Coordination Service

enrol/protocol messages e n r

  • l

/ p r

  • t
  • c
  • l

m e s s a g e s

context

slide-32
SLIDE 32

WS-CAF face-to-face, Boston 3rd to 4th December 2003

AssertionType

  • “Base class” for all coordinator-to-

participant message interactions

– Requests and responses

  • All protocol specific messages enhance

this type

  • One service (participant or coordinator)

can accept multiple protocols

– Bridging

slide-33
SLIDE 33

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Operation basics

  • Participant accepts

– getStatus, AssertionType and getIdentity – AssertionType is the key to extensibility

  • All protocol messages are AssertionTypes
  • Think of it as a pure-virtual base class/interface

– The coordinator and participant agree on the format of AssertionTypes

  • Out of scope for WS-CF
slide-34
SLIDE 34

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Operation basics

  • The Coordinator accepts

– status, AssertionType, identity, wrongState and generalFault – Participant can make asynchronous calls to coordinator (setResponse) – addParticipant/removeParticipant and a few

  • thers
slide-35
SLIDE 35

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Coordinator-to- participant

Participant Coordinator Participant AssertionTy pe message wrongState AssertionTy pe message identity Coordinator generated Participant generated generalFault getIdentity getStatus status

slide-36
SLIDE 36

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Participant-to- coordinator

slide-37
SLIDE 37

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Qualifiers

  • Runtime protocol extensibility option
  • Typically in enlist/delist

– For coordinator/participant information – E.g., will cancel in 24 hours

slide-38
SLIDE 38

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Interposition

  • Important for security and performance

reasons

– Part of most distributed transaction protocols

  • Subordinate coordinator

– Participant as far as coordinator is concerned – Coordinator as far as participant is concerned

  • Supported by WS-CF

– Not mandated

slide-39
SLIDE 39

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Example

Participant/ proxy-coordinator Coordinator Participant

slide-40
SLIDE 40

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Recovery

  • Distributed application federated into

natural recovery (admin) domains

– Can’t mandate one specific recovery mechanism

  • Very application specific anyway

– Have to allow administrative domains autonomy

  • Therefore, support but not mandate
slide-41
SLIDE 41

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Recovery support

  • RecoveryCoordinator

– Drives recovery on behalf of participant – Participants may not be able to recover at same URI

  • Machine crash, domain migration, …
  • Coordinator can replace one endpoint with

another to continue protocol

slide-42
SLIDE 42

WS-CAF face-to-face, Boston 3rd to 4th December 2003

But …

  • Very participant driven
  • What if coordinator moves?

– Out of scope – Implementation specific

  • Context could be augmented with alternate

endpoints

slide-43
SLIDE 43

WS-CAF face-to-face, Boston 3rd to 4th December 2003

WS-TXM

  • Transactions for Web services
  • Builds on WS-CF and WS-Context
  • Based on experience of using Web service

transactions

– OASIS BTP – Role-your-own

  • Intended as a live document

– New models can be added as required

  • Scope of activity becomes scope of transaction
slide-44
SLIDE 44

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Goals

  • Support range of use cases
  • “One-size does not fit all”

– Therefore a single protocol cannot cope with all requirements – All requirements aren’t “two-phase”

  • BT

– Weighted voting for weaker consistency

  • PMI

– Three phase

slide-45
SLIDE 45

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Where does it fit?

  • Web Services are as much about

interoperability as they are about the Web

  • In the short term Web Services

transactions will be about interoperability between existing TP systems rather than running transactions over the Web

  • Companies aren’t going to discard existing

investments

– Need to use what they’ve paid for!

slide-46
SLIDE 46

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Defines

  • Three transaction models

– ACID transaction

  • For interoperability and high-cost services where ACID

transactions are a requirement

– Long running action

  • Loosely coupled, long duration work that uses

compensations

– Business process

  • For treating all steps in an automated business process as

part of a single logical transaction

slide-47
SLIDE 47

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Relationship to WS-CF

  • Builds on WS-CF
  • All protocols define all optional parts of

that specification

– Use AssertionTypes

  • Augment context
slide-48
SLIDE 48

WS-CAF face-to-face, Boston 3rd to 4th December 2003

ACID Transaction

  • Traditional ACID transaction with two sub-

protocols (different URIs)

– Two-phase commit – Synchronizations

  • Interoperability across different vendor

implementations

– removeParticipant illegal – coordinate cannot be used

slide-49
SLIDE 49

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Model

  • ACID semantics explicitly required
  • Presumed rollback
  • One-phase optimization
  • Read-only optimization
  • Heuristics
slide-50
SLIDE 50

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Example

Co o r d i n a t o r Co o r d i n a t o r Co o r d i n a t o r Co o r d i n a t o r begin method addParticipant completeWithStatus prepare Ap p l i c a t i o n Ap p l i c a t i o n Ap p l i c a t i o n Ap p l i c a t i o n Se r v i c e Se r v i c e Se r v i c e Se r v i c e Pa r t i c i p a n t Pa r t i c i p a n t Pa r t i c i p a n t Pa r t i c i p a n t commit Implementation (2PC) “prepare” “rollback” “commit” “prepare” “rollback” “prepare” “rollback” “commit” prepared ok committed committed

slide-51
SLIDE 51

WS-CAF face-to-face, Boston 3rd to 4th December 2003

2PC protocol messages

  • Usual suspects for two-phase commit

– prepare

  • voteReadonly, voteCommit, voteRollback
  • And heuristics

– commit

  • Heuristics

– rollback

  • Heuristics
slide-52
SLIDE 52

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Synchronization messages

  • beforeCompletion

– Runs before two-phase commit begins

  • afterCompletion

– Runs after two-phase protocol

slide-53
SLIDE 53

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Long running action model

  • Specifically for long duration interactions
  • ACID transactions are not appropriate

– Can’t lock resources for the duration – No assumed trust relationships

  • Compensation actions used

– Forward work to return the business state to consistency

  • E.g., credit your credit card and give you back

interest payments

slide-54
SLIDE 54

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Relationship to context and coordination

  • Activity becomes the scope of business

interactions

– Travel agent, computer construction, etc.

  • How services do work is not important

– Back-end implementation choice

  • If work can be compensated then

compensation is bound to the activity

– Non-atomic behaviour

  • Activities can be nested
slide-55
SLIDE 55

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Activities and compensators

  • Each activity is a unit of compensatable work
  • Work performed must remain compensatable for

duration of activity

– Heuristics again! – TimeLimit qualifier

  • Nested activities imply nested compensators

– Could be different compensator from child to parent

slide-56
SLIDE 56

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Travel agent example

slide-57
SLIDE 57

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Context

<xs:element name="context"> <xs:complexType> <xs:complexContent> <xs:extension base="wstxm:ContextType"> <xs:sequence> <xs:element name="lra-id" type="xs:anyURI"/> <xs:element name="coordinator-hierarchy"> <xs:complexType> <xs:sequence> <xs:element name="coordinator-location" type="xs:anyURI" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> </xs:element>

slide-58
SLIDE 58

WS-CAF face-to-face, Boston 3rd to 4th December 2003

To compensate or not?

  • Some services may not be able to

compensate

  • The user defines whether or not this is

important

– MustUnderstand

  • Must be an explicit choice

– Adverse consequences otherwise

slide-59
SLIDE 59

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Compensators

slide-60
SLIDE 60

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Requirements on Services

  • Log sufficient information to compensate

– Best effort only

  • For failure recovery too
slide-61
SLIDE 61

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Example

LRA LRA LRA LRA Appl i cat i on Appl i cat i on Appl i cat i on Appl i cat i on Com pensat or Com pensat or Com pensat or Com pensat or begin Ser vi ce Ser vi ce Ser vi ce Ser vi ce Ser vi ce Ser vi ce Ser vi ce Ser vi ce

  • peration
  • peration

addParticipant addParticipant compensate complete (FAIL) Com pensat or Com pensat or Com pensat or Com pensat or compensate

slide-62
SLIDE 62

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Concurrent LRAs

  • Activities can be concurrent

– Therefore, LRAs can be too

  • Allows selection of work within overall

activity

– E.g., choosing the cheapest flight

slide-63
SLIDE 63

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Selection of work

slide-64
SLIDE 64

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Business process model

  • Aimed at long running interactions that

span different domains and models

– Workflow – Messaging – Traditional ACID transactions

  • Federated systems that can’t/won’t expose

back-end implementations

slide-65
SLIDE 65

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Domains

  • All parties reside within business domains

– Recursive structure is allowed – May represent a different transaction model

  • Business process is split into business

tasks

– Execute within domains – Compensatable units of work

  • Forward compensation during activity is allowed

– Keep business process making forward progress

slide-66
SLIDE 66

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Travel agent

Book taxi task Book theatre task Book restaurant task Flight task Insurance task Flight reservation task

slide-67
SLIDE 67

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Model

  • Supports synchronous and asynchronous

interactions

– Users can submit work and call back later – Or interact synchronously (traditionally)

  • Business Process manager
  • Optimistic rather than pessimistic

– Assumes failures are rare and can be handled

  • ffline if necessary
  • Pragmatic approach
slide-68
SLIDE 68

WS-CAF face-to-face, Boston 3rd to 4th December 2003

How does it work?

  • Each domain is exposed as a subordinate

coordinator

– Responsible for mapping incoming BP requests to domain specific protocol

  • Protocol messages

– checkpoint, confirm, cancel, restart, workStatus

slide-69
SLIDE 69

WS-CAF face-to-face, Boston 3rd to 4th December 2003

checkpoint/restart

  • Application driven

– E.g., via coordinate message

  • Checkpoints are created across the

domains

– Uniquely identified

  • Domains can then roll back to specific

checkpoint

slide-70
SLIDE 70

WS-CAF face-to-face, Boston 3rd to 4th December 2003

workstatus

  • Domain calls back to coordinator to inform

it of final status

  • Or application can enquire

– WorkCancelled – WorkCompleted – WorkProcessing

slide-71
SLIDE 71

WS-CAF face-to-face, Boston 3rd to 4th December 2003

confirm/cancel

  • BP termination protocol messages
  • Map to success/failure of activity
  • Because long-running, heuristics may
  • ccur

– Mixed responses from domains – Sufficient information to allow administrative handling

slide-72
SLIDE 72

WS-CAF face-to-face, Boston 3rd to 4th December 2003

Conclusions

  • Phew!
  • Each specification offers useful

functionality

  • Some overlap with other proprietary

specifications

  • Good feedback from developers and

potential users