The WS-Resource Framework is a set of proposed standards that formalizes the relationship between Web services and state. If you do anything involving the Web and persistent data, you know how important this is. This article, the first of a multi-part series, examines that framework. It is excerpted from chapter 8 of the book Building Web Services with Java: Making sense of XML, SOAP, WSDL, and UDDI, written by Steve Graham et al. (Sams; ISBN: 0672326418).
Web Services and Stateful Resources (Page 1 of 5 )
Chapter 8: Web Services and Stateful Resources
Almost every computer system has some form of state or state management. By state, we mean a set of persistent data or information items that have a lifetime longer than a single request/response message exchange between a requestor and the Web service. An airline reservation system manages the current state of flights, reservations, airplane capacity, seating arrangements, and so on. This state lasts much longer than the duration of a particular set of message exchanges to create a reservation or cancel a reservation. In a supply chain, the current state of the request for quotes (RFQs), purchase orders, invoices and so on is managed. Most systems of any consequence have some form of state. Many Web service interfaces allow for the manipulation of state; that is, the existence of state is implied by the Web service interface. For example, a purchase order Web service implies the presence of the "purchase order" state associated with the various operations defined on the interface. Because these kinds of interfaces are common, it's important to understand the relationship between Web services and state.
To this point in the evolution of Web services technology, no formal mechanism has been proposed to represent the relationship between Web services and state. Currently, each application deals with stateful resources in a slightly (and occasionally radically) different manner. The lack of a standard convention means there is limited motivation for the industry to produce hardened, reusable middleware, tooling, design practices, and experiences upon which Web services applications can be built. This results in increased integration cost between systems that deal with stateful resources in different ways.
This chapter discusses a recent set of proposed standards that formalize the relationship between Web services and state: WS-Resource Framework. The WS-Resource Framework was developed by Computer Associates, Fujitsu, Globus (a major open-source provider of Grid middleware), Hewlett-Packard, and IBM and has been submitted to the OASIS standards organization. A set of five specifications and a white paper outline an approach to modeling stateful resources using Web services. The five specifications are WS-ResourceProperties, WS-ResourceLifetime, WS-ServiceGroup, WS-RenewableReferences, and WS-BaseFaults. We'll examine these specifications in more detail later in this chapter.
Built on top of the WS-Resource Framework is a family of specifications called WS-Notification, which defines a Web services standard approach to asynchronous notification message delivery, or the so-called publish/subscribe (pub/sub) pattern. We'll also review the WS-Notification specifications in this chapter.
Web Services and State
Fundamentally, Web services are best modeled as stateless message processors that accept request messages, process them in some fashion, and (usually) formulate a response to return to the requestor. Web services are typically implemented by stateless components such as Java servlets or EJB stateless session beans. It's left to the implementation to figure out how (or if) any information about the request needs to be stored more permanently (such as in a database) or whether additional information needs to be acquired (such as a lookup into a file in the filesystem) in order to properly process the Web service message.
Therefore, a Web service (a stateless entity) is separate from any persistent state that it might need in order to complete the processing of request messages. This notion of the separation of Web service and state (a so-called "first amendment of the Web services constitution," to make a poor attempt at humor by historical and political analogy) is at the heart of the WS-Resource Framework.