Welcome!

Microservices Expo Authors: Liz McMillan, Todd Matters, Pat Romanski, Elizabeth White, Stefana Muller

Related Topics: Microservices Expo

Microservices Expo: Article

Introducing WS-CAF - More than just transactions

Introducing WS-CAF - More than just transactions

Web services have become the integration platform of choice for enterprise applications. Those applications by the very nature of their enterprise-scale components can be complex in structure, which is compounded by the need to share common data or context across business processes supported by those applications. Those processes may be very long lived, and may contain periods of inactivity, for example, where constituent services require user interactions.

In response to these issues, WSCAF (Web Services Composite Application Framework) was publicly released in July 2003 after almost two years of effort, and has broad industry support from companies such as Iona, Oracle, Sun, and a host of others, and is now under the care of an OASIS standardization effort through the WS-CAF Technical Committee. The WS-CAF specifications are a suite of protocols designed to provide the necessary framework for composing Web services into larger aggregate business processes. Given that WS-CAF is the first framework of its kind to make its way into standardization, it's important to understand the principles underpinning it.

This article provides a high-level view of WS-CAF starting from the bottom up, explaining the layered architecture of the trio of specifications that comprise WS-CAF, and demonstrating how each of the specifications can be used in its own right or as a whole to provide a rich framework for building reliable composite applications.

WS-Context (WS-CTX)
The ability to scope units of work (known as activities) is a requirement of a variety of aspects of distributed applications. In order to correlate the work of multiple Web services within the same activity, it's necessary to propagate additional information - the context - to each participating service. The context contains information such as a unique ID that allows a series of operations to share a common outcome, and is propagated in a SOAP header block whenever application messages are transmitted between component services. The reliable management of the contexts that provide distributed application scope is addressed by the WS-Context specification.

The purpose of a context is to allow multiple individual Web services to enter a relationship by sharing certain common attributes as an externally modeled entity. Typical reasons for Web services to share context include common security domains where multiple Web services execute within the scope of a single authorized session, or common outcome negotiation where each party within the activity needs to know whether each of the other participants successfully completed his or her work.

The structure of a context is application specific (as we shall see, WS-CoordinationFramework and WS-TransactionManagement both extend the basic WSContext context for their own purposes), but contains at a minimum a unique ID in the form of a URI. Web services are identified as participants in the activity by including the context in an application message's SOAP header block (see Listing 1).

In general terms, a context defines basic information about the activity structure. It contains information necessary for multiple Web services to be associated with the same activity, which may be dynamically updated by services as the application or process makes progress. Activities are managed by the context service, which maintains a repository of shared contexts associated with execution environments. Whenever messages are exchanged within the scope of an activity, the context service can supply the associated context, which may then be propagated with those messages. The Context Service also manages hierarchies of contexts to support nesting and concurrency.

As we have seen, the core context propagation framework provides a generic context structure that enables an activity to be uniquely identified so that work can be correlated. Additionally, it supports application- and service-specific extensions to the context, structure. To facilitate this, the context consists of:

  • A mandatory URI identifier called <context-identifier>: Guarantees global uniqueness for an individual activity
  • An optional list of child activities: The <child-contexts> element
  • A <timeout> element: Indicates how long the context information is valid

    In addition to the context service, each Web service participating in an activity may register an Activity Lifecycle Service (or ALS) with the Context Service, which allows that service to be informed about the lifetime of the context. As we shall see, the ALS is the key component in utilizing WS-Context as the base protocol for other higher-level protocols. During execution, when a context is required for the activity associated with the current execution environment, the Context Service calls each registered ALS and obtains additional content for the basic context from it; from this it eventually assembles the entire context document that can be propagated.

    The relationship between ALS and context service, application services, and applications is shown in Figure 1.

     

    WS-Context does not mandate how contexts are actually created, but the canonical route is via the Activity Lifecycle services, which "plug-in" to the Context Service. In this respect, the exact structure and semantics of an activity are defined by the combination of ALSs that have been associated with the activity. For example, a Context Service may have a transaction ALS and security ALS registered with it, so that when an activity is started, any context that is created will contain any necessary transaction and security information.

    WS-Coordination Framework (WS-CF)
    WS-CF is the middle layer in the WSCAF set of specifications and provides an extensible framework that supports a wide range of different coordination protocols (e.g., two-phase or three-phase commit).

    While WS-Coordination Framework is ostensibly similar to WS-Coordination, the main differentiator is that WS-CF defines more of the coordinator's architecture than WS-Coordination (which leaves most things up to the services that use it). For example, in WS-CF you can actually inquire as to the status of a coordinator without having to know the details of the protocol (and its implementation). In many ways, WS-CF can be considered a superset of the WS-Coordination.

    Figure 2 illustrates how individual Web services as well as composite applications can register as participants with a coordinator, which takes over responsibility for context management and notifying participants of the outcome of a series of related Web services executions. As the figure shows, a coordinator can register itself with another coordinator and become a participant, thereby improving interoperability.

     

    WS-Transaction Management (WS-TXM)
    WS-TXM builds on WS-CF to provide transactional coordination. Figure 3 illustrates the layering of WS-TXM protocols. WS-TXM defines a set of pluggable transaction protocols that can be used with the coordinator to negotiate a set of actions for all participants to execute based on the outcome of a series of related Web services executions. The executions are related through the use of shared context (scopes) that can be nested (parent-child relationships) and concurrent.

     

    WS-TXM actually embodies three separate extended transaction protocols. Like WS-Transaction and BTP, WS-TXM provides models that are designed to accommodate multiple use cases, from tightlycoupled intranet-based transactions (TXACID), to Internet-scale, long-lived transactions (TX-LRA), to business process-oriented transactions (TX-BP).

    ACID Transactions
    This model is designed to support interoperability of existing transaction processing systems via Web services, since such systems already form the backbone of enterprise class applications. Although ACID transactions may not be suitable for all Web services, they are most definitely suitable for some, and particularly highvalue interactions such as those involved in finance. As a result, the ACID transaction model defined in WS-TXM has been designed with interoperability in mind. In the ACID model, each activity is bound to the scope of a transaction, so that the end of an activity automatically triggers the termination (commit or rollback) of the associated transaction.

    Long Running Activities (LRA)
    The LRA protocol is designed for those business interactions that are long in duration. Within this model, all work performed within the scope of an application should be compensatable. Therefore, an application's work is either performed successfully or undone. How individual Web services perform their work and ensure it can be undone if compensation is required is an implementation choice. The LRA model simply defines the triggers for compensation actions and the conditions under which those triggers are executed.

    There is a caveat to this model though. Application services may not be compensatable (e.g., an application-level service that prints and mails checks), or the ability to compensate may be transient. The LRA model allows applications to combine services that can be compensated with those that cannot be compensated. Obviously, by mixing the two service types the user may end up with a business activity that will ultimately not be undone by the LRA model, but which may require outside (application-specific) compensation.

    The LRA model defines a protocol actor called a compensator that operates on behalf of a service to undo the work it performs within the scope of an LRA. How compensation is carried out will obviously be dependent upon the service; compensation work may be carried out by other LRAs which themselves have compensators.

    When a service performs work that may later have to be compensated within the scope of an LRA, it enlists a compensator participant with the LRA coordinator. The coordinator will send the compensator one of the following messages when the activity terminates:

  • Success: The activity has completed successfully. If the activity is nested, then compensators may propagate that outcome to the enclosing LRA.
  • Fail: The activity has not completed. All compensators that are registered with the LRA will be invoked to perform compensation in reverse order. The coordinator forgets about all compensators that indicated they operated correctly. Otherwise, compensation may be attempted again or a compensation violation has occurred and must be logged.

    LRAs may be used both sequentially and concurrently, where the termination of an LRA signals the start of some other unit of work within an application. However, LRAs are units of compensatable work and an application may have as many units of work operating simultaneously as it needs to accomplish its tasks. Furthermore, the outcome of work within LRAs may determine how other LRAs are terminated.

    An application can be structured so that LRAs are used to assemble units of compensatable work and then held in the active state while the application performs other work in the scope of different (concurrent or sequential) LRAs. Only when the right subset of work (LRAs) is arrived at by the application will that subset be confirmed; all other LRAs will be told to cancel (complete in a failure state).

    Business Process (BP)
    The BP protocol is significantly different from any of the other transaction models we have seen to date (and there is no directly comparable model in either WSTransaction or BTP). This model is specifically aimed at tying heterogeneous transaction domains together into a single business- to-business transaction. For example, with the BP model it's possible to have a long-running business transaction span messaging, workflow, and traditional ACID transactions, allowing enterprises to leverage their existing IT investment.

    In the business process transaction model, all parties involved in a business process reside within business domains, which may themselves use business processes to perform work. Business process transactions are responsible for managing interactions between these domains. A business process is split into business tasks and each task executes within a specific business domain. A business domain may itself be subdivided into other business domains recursively.

    Each domain may represent a different transaction model if such a federation of models is more appropriate to the activity. Each business task (which may be modelled as a scope) may provide implementation- specific countereffects in the event the enclosing scope must cancel. Furthermore, the controlling application may periodically request that all business domains checkpoint their state so that they can either be consistently rolled back to that checkpoint by the application or restarted from the checkpoint in the event of a failure.

    Figure 4 shows an online travel agent interacting with its suppliers, each of which resides in its own business domain. The work necessary to obtain each component is modelled as a separate task. In this example, the Flight Reservation task is actually composed of two subtasks - one gets the flight and the other gets the necessary travel insurance.

     

    In this example, the user may interact synchronously with the travel agent to build up the required details of the holiday. Or, the user may submit an order (possibly with a list of alternate requirements, such as destinations, dates, etc.) to the agent, who will call back when it has been filled. Likewise, the travel agent then submits orders to each supplier, requiring them to call back when each component is available (or is known to be unavailable).

    Business domains are instructed to perform work within the scope of a global business process. The business process has an overall manager that may be informed by individual tasks when they have completed their work or it may periodically communicate with each task to determine its current status. In addition, each task may make checkpoints of its progress so if a failure occurs, it may be restarted from that point rather than having to start from the beginning. A business process can either terminate in a confirmed (successful) manner, in which case all of the work requested will have been performed, or it will terminate in a cancelled (unsuccessful) manner, in which case all of the work will be undone.

    If it cannot be undone, then this fact must be logged.

    Summary
    From a distance, WS-CAF may be misinterpreted simply as the industry's third attempt at designing a transaction management solution for Web services. However, while one aspect of WS-CAF does address the kind of extended transaction models that are crucial for Web services reliability, there is actually much more to WS-CAF than just transactions. WS-CAF also provides generic context-management and service-coordination frameworks that can form the basis of composite applications, processes, and workflows. These features are exposed to Web services-based applications and can be tailored to build protocols that are specific to particular applications domains.

    References

  • Webber J., and Little M.C. (May 2003) "Introducing WS-Coordination, part 1" Web Services Journal, Vol. 3, Issue 5.
  • Little M.C. and Webber J. (June 2003) "Introducing WS-Transaction, part 2," Web Services Journal. Vol. 3, Issues 6-7.
  • Dalal, S., et al. ( January 2003). "Coordinating Business Transactions on the Web." IEEE Internet Computing Special Edition on Web Services.

    Comparison Between OASIS BTP and WS-Coordination/Transaction
    WS-CAF is not the only transactional coordination protocol for Web services. Indeed, in the past we've seen OASIS BTP and IBM/Microsoft/BEA WSCoordination and WS-Transaction. To help illustrate the features of WS-CAF, it is instructive to take a look at the factorization and features of the prior efforts.

    OASIS BTP was the first transaction protocol to gain real traction for Web services. It consists of a single API that supports two distinct transaction models, known as atom and cohesion. The atom model is a straightforward two-phase protocol where all participants in a transaction see the same outcome, although BTP does not impose any semantics on what action a particular participant takes on receipt of an outcome message (an atom may or may not be ACID). The cohesion model is more complex, and allows the set of participants to change throughout the duration of the transaction, up until the point when the confirmation protocol executes. However, unlike the atom model, BTP cohesions may deliver different outcome messages to individual participants, based on the combination of responses from participants and some business logic.

    Similarly, WS-Transaction has two transaction models: atomic transactions require ACID semantics and mandate that resources are locked for the transaction's duration. Business activities, on the other hand, are designed for use in long-running transactions. They ensure that any updates to state in a system are made immediately, significantly reducing the period during which locks must be held. WS-Transaction has no notion of a two-phase commit for a business activity because commits are made immediately on receipt of the associated messages. If a failure occurs, a business activity runs compensating actions to restore data to a consistent form.

    Underpinning WS-Transaction is WS-Coordination, which provides a generic mechanism for context creation and coordination and is extended through protocol plug-ins that provide domain-specific coordination facilities.

    Figure 5 highlights the two key differences between the specifications. The most striking feature is that each offers different transaction models at the uppermost layers, but it is important to note that the WS-Coordination layer in the WSTransaction/ WS-Coordination stack is also available for applications to build on. In the WS-CAF stack, the WS-Context layer is also exposed for use.

     
  • More Stories By Mark Little

    Mark Little was Chief Architect, Transactions for Arjuna Technologies Ltd, a UK-based company specialising in the development of reliable middleware that was recently acquired by JBoss, Inc. Before Arjuna, Mark was a Distinguished Engineer/Architect within HP Arjuna Labs in Newcastle upon Tyne, England, where he led the HP-TS and HP-WST teams, developing J2EE and Web services transactions products respectively. He is one of the primary authors of the OMG Activity Service specification and is on the expert group for the same work in J2EE (JSR 95). He is also the specification lead for JSR 156: Java API for XML Transactions. He's on the OTS Revision Task Force and the OASIS Business Transactions Protocol specification. Before joining HP he was for over 10 years a member of the Arjuna team within the University of Newcastle upon Tyne (where he continues to have a Visiting Fellowship). His research within the Arjuna team included replication and transactions support, which include the construction of an OTS/JTS compliant transaction processing system. Mark has published extensively in the Web Services Journal, Java Developer's Journal and other journals and magazines. He is also the co-author of several books including “Java and Transactions for Systems Professionals” and “The J2EE 1.4 Bible.”

    More Stories By Jim Webber

    Dr. Jim Webber is a senior researcher from the University of Newcastle
    upon Tyne, currently working in the convergence of Web Services and Grid
    technologies at the University of Sydney, Australia. Jim was previously
    Web Services architect with Arjuna Technologies where he worked on Web
    Services transactioning technology, including being one of the original
    authors of the WS-CAF specification. Prior to Arjuna, Jim was the lead
    developer with Hewlett-Packard on the industry's first Web Services
    Transaction solution. Co-author of "Developing Enterprise Web Services -
    An Architect's Guide," Jim is an active speaker and author in the Web
    Services space. Jim's home on the web is http://jim.webber.name

    Comments (1) View Comments

    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.


    Most Recent Comments
    melliti 12/13/03 01:46:28 PM EST

    I m a student and im interessted in your articles.
    think you

    @MicroservicesExpo Stories
    New competitors, disruptive technologies, and growing expectations are pushing every business to both adopt and deliver new digital services. This ‘Digital Transformation’ demands rapid delivery and continuous iteration of new competitive services via multiple channels, which in turn demands new service delivery techniques – including DevOps. In this power panel at @DevOpsSummit 20th Cloud Expo, moderated by DevOps Conference Co-Chair Andi Mann, panelists examined how DevOps helps to meet the de...
    For most organizations, the move to hybrid cloud is now a question of when, not if. Fully 82% of enterprises plan to have a hybrid cloud strategy this year, according to Infoholic Research. The worldwide hybrid cloud computing market is expected to grow about 34% annually over the next five years, reaching $241.13 billion by 2022. Companies are embracing hybrid cloud because of the many advantages it offers compared to relying on a single provider for all of their cloud needs. Hybrid offers bala...
    "When we talk about cloud without compromise what we're talking about is that when people think about 'I need the flexibility of the cloud' - it's the ability to create applications and run them in a cloud environment that's far more flexible,” explained Matthew Finnie, CTO of Interoute, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
    @DevOpsSummit at Cloud Expo taking place Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center, Santa Clara, CA, is co-located with the 21st International Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The widespread success of cloud computing is driving the DevOps revolution in enterprise IT. Now as never before, development teams must communicate and collaborate in a dynamic, 24/7/365 environment. There is ...
    What's the role of an IT self-service portal when you get to continuous delivery and Infrastructure as Code? This general session showed how to create the continuous delivery culture and eight accelerators for leading the change. Don Demcsak is a DevOps and Cloud Native Modernization Principal for Dell EMC based out of New Jersey. He is a former, long time, Microsoft Most Valuable Professional, specializing in building and architecting Application Delivery Pipelines for hybrid legacy, and cloud ...
    Containers, microservices and DevOps are all the rage lately. You can read about how great they are and how they’ll change your life and the industry everywhere. So naturally when we started a new company and were deciding how to architect our app, we went with microservices, containers and DevOps. About now you’re expecting a story of how everything went so smoothly, we’re now pushing out code ten times a day, but the reality is quite different.
    There's a lot to gain from cloud computing, but success requires a thoughtful and enterprise focused approach. Cloud computing decouples data and information from the infrastructure on which it lies. A process that is a LOT more involved than dragging some folders from your desktop to a shared drive. Cloud computing as a mission transformation activity, not a technological one. As an organization moves from local information hosting to the cloud, one of the most important challenges is addressi...
    For organizations that have amassed large sums of software complexity, taking a microservices approach is the first step toward DevOps and continuous improvement / development. Integrating system-level analysis with microservices makes it easier to change and add functionality to applications at any time without the increase of risk. Before you start big transformation projects or a cloud migration, make sure these changes won’t take down your entire organization.
    21st International Cloud Expo, taking place October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA, will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud strategy. Me...
    "We are a monitoring company. We work with Salesforce, BBC, and quite a few other big logos. We basically provide monitoring for them, structure for their cloud services and we fit into the DevOps world" explained David Gildeh, Co-founder and CEO of Outlyer, in this SYS-CON.tv interview at DevOps Summit at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
    Microservices are increasingly used in the development world as developers work to create larger, more complex applications that are better developed and managed as a combination of smaller services that work cohesively together for larger, application-wide functionality. Tools such as Service Fabric are rising to meet the need to think about and build apps using a piece-by-piece methodology that is, frankly, less mind-boggling than considering the whole of the application at once. Today, we'll ...
    Cloud Expo, Inc. has announced today that Andi Mann and Aruna Ravichandran have been named Co-Chairs of @DevOpsSummit at Cloud Expo Silicon Valley which will take place Oct. 31-Nov. 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. "DevOps is at the intersection of technology and business-optimizing tools, organizations and processes to bring measurable improvements in productivity and profitability," said Aruna Ravichandran, vice president, DevOps product and solutions marketing...
    In his session at Cloud Expo, Alan Winters, an entertainment executive/TV producer turned serial entrepreneur, presented a success story of an entrepreneur who has both suffered through and benefited from offshore development across multiple businesses: The smart choice, or how to select the right offshore development partner Warning signs, or how to minimize chances of making the wrong choice Collaboration, or how to establish the most effective work processes Budget control, or how to ma...
    SYS-CON Events announced today that CA Technologies has been named "Platinum Sponsor" of SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. CA Technologies helps customers succeed in a future where every business - from apparel to energy - is being rewritten by software. From planning to development to management to security, CA creates software that fuels transformation for companies in the applic...
    In the decade following his article, cloud computing further cemented Carr’s perspective. Compute, storage, and network resources have become simple utilities, available at the proverbial turn of the faucet. The value they provide is immense, but the cloud playing field is amazingly level. Carr’s quote above presaged the cloud to a T. Today, however, we’re in the digital era. Mark Andreesen’s ‘software is eating the world’ prognostication is coming to pass, as enterprises realize they must be...
    A common misconception about the cloud is that one size fits all. Companies expecting to run all of their operations using one cloud solution or service must realize that doing so is akin to forcing the totality of their business functionality into a straightjacket. Unlocking the full potential of the cloud means embracing the multi-cloud future where businesses use their own cloud, and/or clouds from different vendors, to support separate functions or product groups. There is no single cloud so...
    Both SaaS vendors and SaaS buyers are going “all-in” to hyperscale IaaS platforms such as AWS, which is disrupting the SaaS value proposition. Why should the enterprise SaaS consumer pay for the SaaS service if their data is resident in adjacent AWS S3 buckets? If both SaaS sellers and buyers are using the same cloud tools, automation and pay-per-transaction model offered by IaaS platforms, then why not host the “shrink-wrapped” software in the customers’ cloud? Further, serverless computing, cl...
    Hybrid IT is today’s reality, and while its implementation may seem daunting at times, more and more organizations are migrating to the cloud. In fact, according to SolarWinds 2017 IT Trends Index: Portrait of a Hybrid IT Organization 95 percent of organizations have migrated crucial applications to the cloud in the past year. As such, it’s in every IT professional’s best interest to know what to expect.
    The taxi industry never saw Uber coming. Startups are a threat to incumbents like never before, and a major enabler for startups is that they are instantly “cloud ready.” If innovation moves at the pace of IT, then your company is in trouble. Why? Because your data center will not keep up with frenetic pace AWS, Microsoft and Google are rolling out new capabilities. In his session at 20th Cloud Expo, Don Browning, VP of Cloud Architecture at Turner, posited that disruption is inevitable for comp...
    Companies have always been concerned that traditional enterprise software is slow and complex to install, often disrupting critical and time-sensitive operations during roll-out. With the growing need to integrate new digital technologies into the enterprise to transform business processes, this concern has become even more pressing. A 2016 Panorama Consulting Solutions study revealed that enterprise resource planning (ERP) projects took an average of 21 months to install, with 57 percent of th...