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 - Stateful Resources (Page 3 of 5 )
Stateful resources appear in several computing contexts. As seen in the sidebar "History: Open Grid Services Infrastructure (OGSI) 1.0," stateful resources are a major focus of Grid computing. In Grid computing, a major focus is effectively managing the allocation of system resources (such as CPUs and disk storage) among a competing set of computational tasks or jobs. These tasks are typically compute-intensive, scientific, and technical computer programs such as the calculations involved in determining the folding patterns of a protein molecule. Although this sort of workload management problem has been around for many years, Grid computing proposes solutions in a distributed heterogeneous environment that typically lacks a central point of administration. Furthermore, Grid computing is typically associated with distributed, heterogeneous resource allocation that includes a means to estimate and deliver a certain level of quality of service. Because of the distributed nature of the Grid computing problem, Web services was a natural base of technology upon which to build Grid computing standards and solutions.
Similarly, the systems management community is beginning to adopt Web services technologies. Recently, the Web Services Distributed Management (WSDM) group (http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=wsdm) within the OASIS standards organization was formed to develop standard means of using Web services to manage systems resources as well as standard means of managing Web services themselves. The WSDM group recognized the importance of modeling state in Web services, and for some time considered adopting OGSI as the basis of its technology. With the advent of the WS-Resource Framework, the WSDM community now has a more natural Web services standard to adopt.
Finally, as we'll illustrate in the examples in this chapter, stateful resources exist in business-oriented applications of Web services. Because of the diverse set of applications using Web services in a business computing context, the need for standardization of representing and manipulating state using Web services is even more crucial.
You can regard the WS-Resource Framework as a set of standards that are intended to unite the way Grid computing, systems management, and business computing use Web services. With a common base of Web services technologies, it becomes possible to build the sort of dynamic, flexible systems needed by On Demand businesses.
Cardinality of Web Services and WS-Resources
To this point, we've described the notion of a WS-Resource, a stateful resource that is associated with a Web service. This relationship deserves more discussion.
In a typical situation, a particular Web service, deployed at a particular endpoint (such as http://www.skatestown.com/services/PO) can be responsible for processing messages related to many different WS-Resources. As you'll see in the section "Implied Resource Pattern," the WS-Resource Framework specifies how to form a SOAP message in order to make sure the correct WS-Resource processes the message.
In certain situations, a stronger encapsulation exists between the Web service and the stateful resource, forming a one-to-one relationship between them. We call this a singleton pattern of WS-Resource. In this case, the Web service and the stateful resource appear inseparable to the requestor and appear to have the same lifetime. This is in contrast with the more typical one-to-many situation described previously, wherein the Web service has a different lifecycle (it's deployed, running, and then undeployed) than the associated WS-Resources, which are created and destroyed during the lifetime of the Web service.
In many circumstances, a particular WS-Resource is associated with multiple Web services. This situation may occur when there are Web services deployed on multiple endpoints that allow access to the same stateful resource. This is a typical load-balancing technique for scaling Web services to handle a large volume of incoming messages. Multiple Web services may also be used to provide different Web services interfaces onto the same stateful resource.