Web Services and Transactions - OMG · Title: Web Services and Transactions Author: William Cox and...
Transcript of Web Services and Transactions - OMG · Title: Web Services and Transactions Author: William Cox and...
Web Services and TransactionsObject Management Group
Web Services WorkshopFebruary 2003
William CoxSanjay Dalal
BEA Systems, Inc.http://www.bea.com
[email protected]@bea.com
2OMG Web Services Workshop February 2003Copyright 2003 BEA Systems, Inc All Rights Reserved
Agenda
• Web Services and Transactions– Long-running Transactions– Web Services
• Specifications and Standards• Compare
– WS-Transaction and WS-Coordination– Business Transaction Processing
• Driving Convergence• Conclusions• References
3OMG Web Services Workshop February 2003Copyright 2003 BEA Systems, Inc All Rights Reserved
Why do Web Services Need Transactions?• Loosely-coupled• Distributed• Coordination is an issue except for single sequence
– Make error-prone complex transactions easier to program
• New requirements for independent participants– One coordinator can’t demand all participants follow the
coordinator’s business rules– Isolation hard to maintain—one transaction affects another
• XML-based transaction protocols for interoperability
4OMG Web Services Workshop February 2003Copyright 2003 BEA Systems, Inc All Rights Reserved
The Case for Long-running Transactions• Existing businesses do them often• Travel agent scenario
– Multiple resources– Variable cost to change/cancel– Business rules vary – Need some consistent set of tickets/reservations– Need a deterministic agreed outcome
• Compensation rather than rollback (usually)—cancel reservation
5OMG Web Services Workshop February 2003Copyright 2003 BEA Systems, Inc All Rights Reserved
Transactions Support Workflow and Choreography
• BPEL4WS• Web Services Choreography Interface (W3C
Note)• ebXML Business Process interactions• Details BTP support for workflows in Potts,
Temel paper (see References)– WSFL– XLANG– BPML
6OMG Web Services Workshop February 2003Copyright 2003 BEA Systems, Inc All Rights Reserved
Web Services and Transactions• To integrate transactions and Web services
need to carry one or more of– Correlation ID– Conversation ID (for long-running conversations,
not necessarily transactional—viz. WLStudio)– Transaction context ID (integer, for atomic single-
site)– Additional context information
• Placed in SOAP Header• Potential for conflicts as SOAP Header is used
more and more
7OMG Web Services Workshop February 2003Copyright 2003 BEA Systems, Inc All Rights Reserved
Specifications and Standards• When is a specification not a standard?• Is the protocol or API over-specified?
Under-specified?• How interoperable is the protocol?• Automatic or manual configuration?• Optimized for common cases?• Consistent architecture and programming
model?
8OMG Web Services Workshop February 2003Copyright 2003 BEA Systems, Inc All Rights Reserved
The Landscape Today
• WS-Transaction + WS-Coordination(WS-T/WS-C)
• OASIS Business Transaction Processing (BTP)
• Others (see references)
9OMG Web Services Workshop February 2003Copyright 2003 BEA Systems, Inc All Rights Reserved
WS-Transaction and WS-Coordination• Published August 2002 by BEA, IBM, and
Microsoft• Factors out transaction context management
and propagation into WS-Coordination• XML with Web services binding• Two sub-protocols in WS-T
– Atomic Transactions (AT)– Business Activities (BA)
10OMG Web Services Workshop February 2003Copyright 2003 BEA Systems, Inc All Rights Reserved
WS-T and WS-C (continued)
• WS-T/AT (atomic) transactions are essentially traditional and tightly-coupled (ACID) —Atomic, Consistent, Isolated, Durable
• Business Activities are richer and allow for looser coupling, relaxation of Isolation and Atomicity
• Both provide Web service/SOAP bindings
11OMG Web Services Workshop February 2003Copyright 2003 BEA Systems, Inc All Rights Reserved
OASIS Business Transaction Protocol• Technical Committee created March 2001 by
BEA, Interwoven, and Sun, soon joined by others
• Committee Specification 1.0 May 2002• XML, with SOAP binding• Two sub-protocols relax ACID properties
– Atoms—Isolation is relaxed – Cohesions—Isolation and Atomicity are relaxed
12OMG Web Services Workshop February 2003Copyright 2003 BEA Systems, Inc All Rights Reserved
OASIS BTP(continued)
• Atoms do (mostly) what atomic transactions do• Cohesions do (mostly) what business
processes do, and are similar to WS-T Business Activities
• Most messages are the same across the two protocols (it’s really two kinds of coordinators)
13OMG Web Services Workshop February 2003Copyright 2003 BEA Systems, Inc All Rights Reserved
Compare
• Superficial Similarities• Real Similarities• Messages• State Diagrams
14OMG Web Services Workshop February 2003Copyright 2003 BEA Systems, Inc All Rights Reserved
Superficial Similarities
• At a high level one might hope that the models align:– WS-T/AT =?= BTP-Atoms– WS-T/BA =?= BTP-Cohesions– WC-Coordination manages contexts as BTP does– Both use XML and Web Services
• But they don’t.• The protocols seem similar• And they are, but optimizations and scalability
are needed for WS-C/WS-T
15OMG Web Services Workshop February 2003Copyright 2003 BEA Systems, Inc All Rights Reserved
A Clearer Comparison
XML with SOAP bindingWeb Services
**Atomic TransactionAtoms*
CohesionsBusiness ActivityBTPWS-T/WS-C
• * WS-Transaction doesn’t address this except as a special case of Business Activity
• **BTP doesn’t address this as loosely coupled implementation of tightly-coupled transactions were explicitly ruled out early on
16OMG Web Services Workshop February 2003Copyright 2003 BEA Systems, Inc All Rights Reserved
A Clearer Comparison (continued)
• Isolation– WS-T/AT mandates strict isolation, while BTP relaxes
isolation—BTP is more loosely coupled
• Binding– WS-T/WS-C tightly bound to Web Services. BTP is an XML
message protocol with a SOAP binding
• Optimizations– BTP “One Shot” optimization should be used in loosely-
coupled interactions with high latency– BTP allows participants to resign without waiting for
coordinator, and allows timeouts for commitments
• WS-T/AT can work well in a tightly-coupled environment
17OMG Web Services Workshop February 2003Copyright 2003 BEA Systems, Inc All Rights Reserved
Real Similarities
• Both WS-T/WS-C and BTP can be used to support business process execution environments, e.g. BPEL4WS, WSFL, WSCI, BPMI, and others
• WS-T Business Activities are similar to BTP Cohesions
18OMG Web Services Workshop February 2003Copyright 2003 BEA Systems, Inc All Rights Reserved
Real Similarities (continued)
• Compensating actions are a problem if too common (the protocol should prevent errors and aid recovery)
• Both are useful as an implementingtechnology, e.g. for workflows
• Both are relatively low level and complex• Neither is the only solution in its problem
domain
19OMG Web Services Workshop February 2003Copyright 2003 BEA Systems, Inc All Rights Reserved
Real Differences(see references)• WS-T/AT is not loosely-coupled• BTP incorporates optimizations
– One-Shot– Participant resignation– Timeouts
• WS-C/WS-T is under specified—there’s not enough to build interoperable implementations from the specs
• WS-T/AT and WS-T/BA are similar but use different messages
• Factoring out of WS-C complicates the transaction protocol
• BTP is an OASIS Committee Specification
20OMG Web Services Workshop February 2003Copyright 2003 BEA Systems, Inc All Rights Reserved
Messages—Normal Case• Normal case: WS-T/AT 1PC or 2PC
• Normal case: WS-T/BA with Completion
• Normal case: BTP
Confirmed || CancelledConfirm || CancelPreparedPrepareRole: InferiorRole: Superior
Closed || CompensatedClose || CompensatePreparedPrepare
Role: ParticipantRole: Coordinator
Committed || AbortedCommit || RollbackPreparedPrepare
Role: ParticipantRole: Coordinator
21OMG Web Services Workshop February 2003Copyright 2003 BEA Systems, Inc All Rights Reserved
WS-C/WS-T State Diagram
Ended
Register
Completed ClosingClose
Compensating
Completed Closed
Figure 2: BusinessAgreement Protocol State Diagram
Participant generatedCoordinator generated
Compensated
Cancel
Active
Canceled
Faulted
Faulted Forget
Canceling
Compensate
Exited
Faulted
WS-Transaction Specification BA Figure 2
22OMG Web Services Workshop February 2003Copyright 2003 BEA Systems, Inc All Rights Reserved
BTP State Diagram Without Optimizations
Canceling Canceled
Prepare
Prepared Confirmed
Enrolled Completed*
PreparedPreparing Confirming
Auto-Cancel
Auto-Confirm
Enroll/Enrolled
C a n c e lResign/Resigned
(Canceling)
Superior (coordinator) generated Inferior (participant) generated
Confirm
(Confirming)
Contradicted
Cancel
Courtesy Sazi Temel
23OMG Web Services Workshop February 2003Copyright 2003 BEA Systems, Inc All Rights Reserved
Ended
Register
Completed ClosingClose
Compensating
Completed Closed
Compensated
Cancel
Active
Canceled
Faulted
Faulted Forget
Canceling
Compensate
Exited
Faulted
WS-T
Canceling Canceled
Prepare
Prepared ConfirmedEnrolled Completed
*PreparedPreparing Confir
ming
Auto-Cancel
Auto-Confirm
Enroll/Enrolled
C a n c e lResign/Resigned
(Canceling)
Superior (coordinator) generated Inferior (participant) generated
Confirm
(Confirming)
Contradicted
Cancel
BTP
24OMG Web Services Workshop February 2003Copyright 2003 BEA Systems, Inc All Rights Reserved
Specifications and Standards (again)• When is a specification not a standard?• Is the protocol or API over-specified?
Under-specified?• How interoperable is the protocol?• Automatic or manual configuration?• Optimized for common cases?• Consistent architecture and programming
model?
25OMG Web Services Workshop February 2003Copyright 2003 BEA Systems, Inc All Rights Reserved
Driving Convergence
• BTP and WS-Transaction/WS-Coordination overlap in significant areas
• Similar goals, different details• Industry would be well-served by convergence
in this space• Standards submission of WS-Transaction and
WS-Coordination would be the next step in driving convergence
26OMG Web Services Workshop February 2003Copyright 2003 BEA Systems, Inc All Rights Reserved
Conclusions
• Both technologies approach broad and complex issues
• Both technologies can support aggregations including composition, workflows, and choreography
• Convergence is going to be important—the industry needs one standard, not two similar-but-different ones
• Either can simplify distributed agreement without making you “roll your own”
27OMG Web Services Workshop February 2003Copyright 2003 BEA Systems, Inc All Rights Reserved
References• On BEA, IBM, and Microsoft web sites (only BEA URL listed)
– WS-Transaction • http://dev2dev.bea.com/techtrack/ws-transaction.jsp
– WS-Coordination• http://dev2dev.bea.com/techtrack/ws-coordination.jsp
– BPEL4WS• http://dev2dev.bea.com/techtrack/BPEL4WS.jsp
• OASIS Business Transaction Processing Web site– http://www.oasis-open.org/business-transactions/
28OMG Web Services Workshop February 2003Copyright 2003 BEA Systems, Inc All Rights Reserved
References (continued)• Choreology Ltd detailed analysis of BTP and WS-
Transaction– Technical discussion
• Link from http://www.choreology.com near bottom left– Peter Furniss and Alastair Green, BTP: WS-T Message
sequence comparisons• http://www.choreology.com/resources/2002-11-
20.message_sequence_comparison.A.ppt
• Papers– Mark Potts & Sazi Temel, Business Transactions in Workflow
and Business Process Management on BTP Web site– Sanjay Dalal, Sazi Temel, Mark Little, Mark Potts, Jim
Webber, Coordinating Business Transactions on the Web, IEEE Internet Computing, Jan/Feb 2003.
• Available on web to IEEE members at http://www.computer.org/internet/ic2003/w1030abs.htm
– Roger Sessions, Shoot-out at the Transaction Corral: BTP versus WS-T at http://www.objectwatch.com/issue_41.htm
29OMG Web Services Workshop February 2003Copyright 2003 BEA Systems, Inc All Rights Reserved
References (continued)
• WSCI– http://www.w3.org/TR/wsci/
• BPML– http://www.bpmi.org/
• XLANG (superseded by BPEL4WS)– http://www.gotdotnet.com/team/xml_wsspecs/xlang-c/
• Web Services Flow Language (superseded by BPEL4WS)– http://www.ibm.com/software/solutions/webservices/pdf/WSFL.pdf