Web Services Resource Framework support
The Web Services Resource Framework (WSRF) support in WebSphere Application Server provides the environment for web service applications that follow the OASIS WSRF specifications.
WSRF overview
Web service interfaces often need to provide stateful interactions with the clients of the service. For example, a web service interface such as a shopping cart, where the result of one operation influences the carrying out of the succeeding operations. The OASIS Web Services Resource Framework (WSRF) defines a generic framework for modelling and accessing stateful resources using web services, so that the definition and implementation of a service and the integration and management of multiple services is easier.
WSRF introduces the concept of an XML document description, called the resource properties document schema, which is referenced by the WSDL description of a web service and which explicitly describes a view of the state of the resource with which the client interacts. A service described in this way is called a WS-Resource.
A WS-Resource is defined as the combination of a resource and a web service through which the resource is accessed. The following figure illustrates a web service, at http://www.example.com/service, and three resources, A, B, and C, which are accessed through the Web service. Three WS-Resources are therefore illustrated in the figure:
A WS-Resource is referenced by a WS-Addressing endpoint reference that uniquely identifies the WS-Resource, typically by containing an identifier of the resource component of the WS-Resource inside the EndpointReference ReferenceParameter element. In the previous example, WS-Resource-C is the combination of the web service and the resource that is identified by C, and a reference to WS-Resource-C might be as follows:
<wsa:EndpointReference> <wsa:Address> http://www.example.com/service </wsa:Address> <wsa:ReferenceParameters> <tns:SomeDisambiguatorElement>C</tns:SomeDisambiguatorElement> </wsa:ReferenceParameters> ... </wsa:EndpointReference>Each such WS-Resource has a resource property document (an XML instance document) that describes a view of the state of the resource. The WSDL for a WS-Resource identifies the XML schema that describes the type of the resource property document through a ResourceProperties attribute of the wsdl:PortType element. By specifying this standard WSDL extension for the resource properties document schema, WSRF enables the definition of simple, generic messages that interact with the WS-Resource.
For example, consider a Printer WS-Resource that has the following resource properties document schema:
<?xml version="1.0"?> <xsd:schema ... xmlns:pr="http://example.org/printer.xsd" targetNamespace="http://example.org/printer.xsd" > <xsd:element name="printer_properties"> <xsd:complexType> <xsd:sequence> <xsd:element ref="pr:printer_name" /> <xsd:element ref="pr:queued_job_count" /> </xsd:sequence> </xsd:complexType> </xsd:element> ... </schema>The WSDL PortType element for such a WS-Resource declares the Resource Properties Document type as follows:
<wsdl:portType xmlns:pr="http://example.org/printer.xsd" xmlns:wsrf-rp="http://docs.oasis-open.org/wsrf/rp-2" name="Printer" wsrf-rp:ResourceProperties="pr:printer_properties">Each WS-Resource has a unique, logical resource properties document instance that is a view of the state of the resource. The WS-ResourceProperties specification describes the interoperable protocol messages that a WS-Resource can implement to get, set, or query the state of the resource by operating on the resource properties document. Some of these operations affect the resource properties document as a whole, and some of them operate on one or more elements within the document (the individual resource properties, for example pr:printer_name). Each WS-Resource can have a finite lifecycle and can be created and destroyed; the WS-ResourceLifetime specification describes the interoperable protocol messages that a WS-Resource can implement to destroy itself or to alter its termination time.
For more information about WSRF, refer to the WSRF Primer document published by the OASIS Technical Committee.
WSRF Programming Model
The WSRF specifications define only the protocol messages and the semantic behavior that is expected of a WS-Resource when it processes these messages; the specifications do not prescribe the means to implement WS-Resource objects. WSRF is primarily an application-level protocol and the tools for implementing WS-Resources are the same tools used for implementing any other type of web service. WSRF uses WS-Addressing endpoint references and the application programming model for WS-Resources is similar to the model for any web service that uses WS-Addressing.
WSRF extends the WAS WS-Addressing programming model in two ways, which differentiate a WS-Resource from a generic resource that is accessed through a web service by using WS-Addressing:
- WSRF requires the ResourceProperties attribute on the wsdlPortType element. This attribute declares that the portType element is implemented by a WS-Resource rather than a generic web service. The WS-Resource must declare which WSRF operations it supports by copying those operations into the portType element of its WSDL definition. The WS-Resource is free to choose any implementation strategy to represent the stateful resource and to process the WSRF messages; we can implement a resource using a simple Java class, a stateless session enterprise bean, an entity bean backed by a relational database, a Service Data Object (SDO), and so on.
- WSRF defines a hierarchy of Java BaseFault types.
Subtopics
- Web Services Resource Framework base faults
The Web Services Resource Framework (WSRF) provides a recommended basic fault message element type from which we can derive all service-specific faults. The advantage of a common basic type is that all faults can, by default, contain common information. This behavior is useful in complex systems where faults might be systematically logged, or forwarded through several layers of software before being analyzed.
- Web Services Resource Framework resource property and lifecycle operations
The Web Services Resource Framework (WSRF) contains specifications that describe the operations that a Web Services Resource (WS-Resource) can implement to get, set, or query the state of the resource by operating on the resource properties document.
Related concepts
Web Services Addressing support Web Services Addressing application programming model
Related information:
WSRF specification
OASIS WSRF primer