Welcome!

Weblogic Authors: Yeshim Deniz, Elizabeth White, Michael Meiner, Michael Bushong, Avi Rosenthal

Related Topics: Weblogic

Weblogic: Article

Transactional Web Services

Transactional Web Services

What are ACID transactions? How do they change to work with Web services? And how do the ACID guarantees work when you must use compensating actions?

Transactions - Formal and Informal
To many people, a "transaction" is a business exchange where money is traded for goods. To software engineers the meaning is more technical. Informally, a transaction implies that a group of activities is completed as a unit, so they all succeed or all fail together. This "all or none" semantic is fundamental to database access.

In the formal model, the groupings we call transactions have properties known by the acronym ACID - they are Atomic, Consistent, Isolated, and Durable (see Table 1).

Enterprise systems, including many parts of Java 2, Enterprise Edition (J2EE), support transactional semantics. For example, Enterprise JavaBeans (EJBs; for storage operations) and the Java Message Service (for messages) have transactional guarantees on their behavior. JTA/JTS (the Java Transaction API and the Java Transaction Service) provide standard APIs for accessing the transactional capabilities provided in compliant software.

ACID and Compensating Transactions
ACID transactions are critical to business interactions - a bank wants to ensure that your account is credited exactly once for a deposit, and you want to ensure that your account is debited exactly once for a withdrawal. Likewise, changes in the data stored in an EJB must be accessed only when it is internally consistent - transactions guarantee that consistent view.

To ensure consistency, typically all database entries being used by an ACID transaction are locked for the duration. If a transaction fails, the database state is rolled back to its previous state. This capability is provided by database vendors.

But locking cannot work across enterprises. When you make a hotel reservation, your travel agent cannot lock the hotel's reservation database for as along as the reservation exists (or even as long as a phone call) or the system would grind to a halt. Instead, an ACID transaction local to the hotel chain's database as a single unit of work (1) updates the room inventory, (2) adds information to the reservation table, and (3) generates a confirmation number. If the travel agent needs to undo that reservation, a compensating action is taken. Sometimes there's a cost to compensate - for example, if the reservation is cancelled too late, there may be a charge.

Compensation is specific to the way business data is managed, so it's always part of business logic. This is very different from the automatic rollback provided by databases for ACID transactions. Compensation avoids another problem. Locking of your company's data by anyone on the Internet allows denial-of-service attacks. Using compensation means that your data isn't locked for a long time, but we can no longer have ACID transactions - at least the Isolation guarantees must be relaxed - because the data is visible between the initial change and the compensation.

In effect, one trades softening of the ACID guarantees for flexibility, safety, and control over one's own data.

Do We Need Web Services Transactions?
Businesses have been doing without Web services (and similar long-running distributed transactions) for a long time. Do we really need them?

In many cases the answer is "no" - for many business needs, a reliable transport (which itself may use local transactions at the ends) plus a simple application protocol will suffice. Many interactions are between just two parties, so general termination protocols are more complicated than necessary. For example, RosettaNet and ebXML Collaborations are inherently two party.

For more complex scenarios, such as interactions managed in a business process environment (see Yaron Goland's article, "The Race to Create Standards," Vol. 2, issue 6), the answer is a qualified "yes" - in part because these are new assemblies of piece parts, and in part because the complexity of systems goes up. I'll return to this question after we look at transaction specifications.

The Specifications - Overview
I've already mentioned ACID transactions and JTA/JTS. The Open Group (formerly X/Open) Distributed Transaction Processing XA specification (1991) defines ACID transactions. JTA/JTS were first specified in the late 1990s.

In XML and Web services there are two key specifications: Business Transaction Processing (BTP) from the OASIS standards organization, published in May 2002; and WS-Transaction with its accompanying specification, WS-Coordination, published by BEA, IBM, and Microsoft, in August 2002.

These specifications have two key concepts in common: compensation instead of rollback, and the use of business logic to determine success or failure rather than all-or-none.

OASIS BTP
OASIS BTP provides two types of transactions. Atoms resemble ACID transactions in that the result is all-or-none - all of the participants succeed, or the transaction fails and the participants compensate for any completed actions.

Cohesions are more flexible. A central coordinator reviews the status of each member of the transaction. Even if some of the members cannot successfully commit the transaction the coordinator can still decide to allow the remaining members to commit. In an ACID transaction such partial success is failure, and all participants must roll back.

For example, you might tentatively reserve rooms at several hotels while building an itinerary, but at the end you only need one hotel for each night, and one flight to the destination. So even if attempting to reserve a room fails at all but one hotel, the transaction can still succeed (see Figure 1).

WS-Coordination and WS-Transaction
This family of two specifications (three, if you count the subparts of WS-Transaction separately) covers much the same territory as BTP cohesions, but adds ACID transactions with Web services as the transport.

WS-Coordination factors out the management and propagation of transaction contexts from the WS-Transaction family of protocols. Context management is a key part of transaction systems. Factoring it out makes it easier to create additional protocols on top of WS-Coordination.

WS-Transaction has two largely unrelated subparts, atomic transactions (AT) and business activities (BA).

WS-Transaction/AT defines ACID transactions using Web services. The goal is to allow interoperability with older ACID-based systems within an enterprise - not across enterprises, for all the reasons we've discussed.

WS-Transaction business activities are another thing altogether - they resemble BTP cohesions, but are tailored as an implementation infrastructure for Business Process Execution Language for Web Services (BPEL4WS), also published in August 2002. Work on BPEL4WS is continuing in an OASIS Technical Committee (see References).

BAs are similar to BTP cohesions: compensating actions are used to undo partially completed work. Business logic (as with cohesions) or a defined business process determine the success or failure of a particular BA.

BAs share the terminology and model with BPEL; the complexities of BA mirror the complexity for an execution language for business processes. In fact, the "BPEL use case" of cross-enterprise business processes and collaboration, as and when they achieve critical mass, are the most compelling use case for WS-Transaction.

Time will tell how rapidly and broadly the adoption of BPEL proceeds, which in turn will drive the adoption of supporting standards.

Future Standards
In the short term, WS-Coordination and WS-Transaction should be submitted to a standards body to start the progress from public specification to standard.

For the longer term, value will be driven by the possibility of legacy integration across operating systems (in the case of AT), and will likely be driven by the attraction of business process integration, management, and execution (in the case of business activities, BTP, or their successors).

At press time, a set of specifications (Web Services Composite Application Framework) was published and promised to be submitted to a standards organization. These overlap with BTP, WS-Transaction, and WS-Coordination. This publication may further accelerate convergence and standardization.

Conclusion
Transactions between enterprises, and support for complex business process execution have driven consideration of technologies that relax some of the ACID transaction guarantees that programmers have used for many years. The need for compensation, rather than rollback, is one basic difference.

The other change is in definitions of success. All-or-nothing semantics work very well in most cases, but the notion of success for a transaction has begun evolving to mean success of a business process, rather than all parts of a transaction are complete.

The WS-Transaction and BTP protocols are among the first formalizations of this new approach, and have similar models. The next months should see the start of standardization of the newer WS-Transaction and WS-Coordination protocols. The widespread adoption of such protocols will depend on the rapidity of adoption of business process environments.

BEA cofounded OASIS BTP, and is a coauthor of the WS-Coordination and WS-Transaction public specifications. We look forward to continuing to drive convergence and broadly accepted standardization in these emerging areas.

References

  • Andrade, Juan, et al. (1996). The Tuxedo System: Software for Constructing and Managing Distributed Business Applications. (Addison-Wesley)
  • Gray, Jim; and Reuter, Andreas (1993). Transaction Processing: Concepts and Techniques (Morgan-Kaufmann)
  • The Open Group (1992). Distributed TP: The XA Specification. Free PDF: www.opengroup.org/products/ publications/catalog/c193.htm
  • OASIS BTP Technical Committee: www.oasis-open.org/committees/ tc_home.php?wg_abbrev=business-transaction. For the specification and primer follow the Documents link at the upper right.
  • WS-Coordination 1.0 (August 2002): http://dev2dev.bea.com/technologies/ webservices/standards.jsp
  • WS-Transaction 1.0 (August 2002): http://dev2dev.bea.com/technologies/ webservices/standards.jsp
  • OASIS Web Services Business Process Execution Language (WS-BPEL) Technical Committee: www.oasis-open.org/committees/ tc_home.php?wg_abbrev=wsbpel
  • Cox, William; and Dalal, Sanjay. "Web Services and Transactions," OMG Workshop on Web Services and the Integrated Enterprise (Philadelphia, April 2003). Earlier version online at www.omg.org/news/meetings/workshops/ WebServEurope_Manual/04-2_Cox.pdf
  • More Stories By William Cox

    Biography
    William Cox is a Technical Director in the BEA CTO Office, concentrating on transactional and portal architecture. He is a co-author of BTP, the BTP Primer, and of WS-Transaction. He holds an M.S. and Ph.D. in Computer Sciences from the University of Wisconsin–Madison.
    References

    Comments (0)

    Share your thoughts on this story.

    Add your comment
    You must be signed in to add a comment. Sign-in | Register

    In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


    IoT & Smart Cities Stories
    The challenges of aggregating data from consumer-oriented devices, such as wearable technologies and smart thermostats, are fairly well-understood. However, there are a new set of challenges for IoT devices that generate megabytes or gigabytes of data per second. Certainly, the infrastructure will have to change, as those volumes of data will likely overwhelm the available bandwidth for aggregating the data into a central repository. Ochandarena discusses a whole new way to think about your next...
    Dynatrace is an application performance management software company with products for the information technology departments and digital business owners of medium and large businesses. Building the Future of Monitoring with Artificial Intelligence. Today we can collect lots and lots of performance data. We build beautiful dashboards and even have fancy query languages to access and transform the data. Still performance data is a secret language only a couple of people understand. The more busine...
    DXWorldEXPO LLC announced today that Big Data Federation to Exhibit at the 22nd International CloudEXPO, colocated with DevOpsSUMMIT and DXWorldEXPO, November 12-13, 2018 in New York City. Big Data Federation, Inc. develops and applies artificial intelligence to predict financial and economic events that matter. The company uncovers patterns and precise drivers of performance and outcomes with the aid of machine-learning algorithms, big data, and fundamental analysis. Their products are deployed...
    All in Mobile is a place where we continually maximize their impact by fostering understanding, empathy, insights, creativity and joy. They believe that a truly useful and desirable mobile app doesn't need the brightest idea or the most advanced technology. A great product begins with understanding people. It's easy to think that customers will love your app, but can you justify it? They make sure your final app is something that users truly want and need. The only way to do this is by ...
    CloudEXPO | DevOpsSUMMIT | DXWorldEXPO are the world's most influential, independent events where Cloud Computing was coined and where technology buyers and vendors meet to experience and discuss the big picture of Digital Transformation and all of the strategies, tactics, and tools they need to realize their goals. Sponsors of DXWorldEXPO | CloudEXPO benefit from unmatched branding, profile building and lead generation opportunities.
    Digital Transformation and Disruption, Amazon Style - What You Can Learn. Chris Kocher is a co-founder of Grey Heron, a management and strategic marketing consulting firm. He has 25+ years in both strategic and hands-on operating experience helping executives and investors build revenues and shareholder value. He has consulted with over 130 companies on innovating with new business models, product strategies and monetization. Chris has held management positions at HP and Symantec in addition to ...
    Cell networks have the advantage of long-range communications, reaching an estimated 90% of the world. But cell networks such as 2G, 3G and LTE consume lots of power and were designed for connecting people. They are not optimized for low- or battery-powered devices or for IoT applications with infrequently transmitted data. Cell IoT modules that support narrow-band IoT and 4G cell networks will enable cell connectivity, device management, and app enablement for low-power wide-area network IoT. B...
    The hierarchical architecture that distributes "compute" within the network specially at the edge can enable new services by harnessing emerging technologies. But Edge-Compute comes at increased cost that needs to be managed and potentially augmented by creative architecture solutions as there will always a catching-up with the capacity demands. Processing power in smartphones has enhanced YoY and there is increasingly spare compute capacity that can be potentially pooled. Uber has successfully ...
    SYS-CON Events announced today that CrowdReviews.com has been named “Media Sponsor” of SYS-CON's 22nd International Cloud Expo, which will take place on June 5–7, 2018, at the Javits Center in New York City, NY. CrowdReviews.com is a transparent online platform for determining which products and services are the best based on the opinion of the crowd. The crowd consists of Internet users that have experienced products and services first-hand and have an interest in letting other potential buye...
    When talking IoT we often focus on the devices, the sensors, the hardware itself. The new smart appliances, the new smart or self-driving cars (which are amalgamations of many ‘things'). When we are looking at the world of IoT, we should take a step back, look at the big picture. What value are these devices providing. IoT is not about the devices, its about the data consumed and generated. The devices are tools, mechanisms, conduits. This paper discusses the considerations when dealing with the...