790 likes | 951 Views
Web Services over the Grid - WSRF -. Enrique de Andrés Saiz. Outline. Generic Web Services problem Web Services Resource Framework (WSRF) WS-Addressing Faults Declaring WS-Resource properties Operations over WS-Resource properties WS-Resource lifetime Grouping services
E N D
Web Services over the Grid- WSRF - Enrique de Andrés Saiz
Outline • Generic Web Services problem • Web Services Resource Framework (WSRF) • WS-Addressing • Faults • Declaring WS-Resource properties • Operations over WS-Resource properties • WS-Resource lifetime • Grouping services • Developing WSRF services • WSRF::Lite • wsrf4egee Web Services over the Grid
Generic Web Services problem • Generic Web Services are limited by the timeouts of the servers that hosts them: • It is not possible to run long time operations • Solution: • Provide asynchronous behavior to the operations of Web Services. • Requirements: • Any kind of data persistence between invocations to the same instance of a Web Service. • A way to uniquely identify instances of Web Services. • Generic Web Services are stateless… they don’t accomplish these requirements. Web Services over the Grid
Inputs Outputs myOp username password … … Inputs Outputs Inputs Outputs Inputs Outputs myOp_submit myOp_status myOp_result username username username … password password password id … Example • Imagine we have a Web Service with operations that: • Require a lot of time to be executed • Require valid credentials to execute them Web Services over the Grid
Inputs Outputs createSession id Inputs Outputs myOp_submit username password username Inputs Inputs Outputs Outputs Outputs Inputs password … myOp_status myOp_result myOp_result username username … … password password id Example Web Services over the Grid
Solving the problem… • Approach 1: • Your own solution as the previous example. • Problems: • Using a parameter for identifying the instance of the Web Services. • No very clear how to get data persistence. • Approach 2: • USING STANDARS. • WSRF (Web Services Resources Framework) defines a generic framework for modeling and accessing persistent resources using Web Services: • It makes easier the definition and implementation of a service and the integration and management of multiple services Web Services over the Grid
Outline • Generic Web Services problem • Web Services Resource Framework (WSRF) • WS-Addressing • Faults • Declaring WS-Resource properties • Operations over WS-Resource properties • WS-Resource lifetime • Grouping services • Developing WSRF services • WSRF::Lite • wsrf4egee Web Services over the Grid
Web Services Resource Framework, WSRF • WSRF is an OASIS standard that can be used to implement interoperable stateful web-services. • WSRF is a set specifications that define what is termed the WS-Resource approach to modeling and managing state in a Web services context. • WSRF uses the W3C standard WS-Addressing to achieve transport-neutral addressing for web-services. Web Services over the Grid
Web Services Resource Framework, WSRF • The central element of WSRF standard is the concept of WS-Resource. • A WS-Resource is the logical entity which stores (persistent) information: • A WS-Resource has defined resource properties: • A resource property is a piece of information defined as part of the state model of a WS-Resource. • A WS-Resource can be accessed through defined message exchanges or operations for: • Accessing resource properties. • Interact with the WS-Resource lifetime. • A WS-Resource is associated to a Web Service instance. • When creating a new service instance, a new WS-Resource is created. • WSRF uses WS-Addressing specification for uniquely identify a WS-Resource (or a Web Service instance). • A reference to a WS-Resource is represented by an endpoint reference (EPR). Web Services over the Grid
Example Simple shopping service example • We have a shopping carts that store one product (WS-Resource) per cart. • A product (WS-Resource) have defined a set of properties (WS-Resource Properties): • ProductCode • Description • Quantity • ProductPrice • It is possible to interact with the properties of the product (Operations over WS-Resource Properties). • It is possible to delete a shopping cart (Operations over WS-Resource Lifetime). Web Services over the Grid
Using WSRF for the Grid • One WS-Resource corresponds to one job on the Grid • WS-Resource properties: • Input data/parameters of the job (or the application executed by the job). • Output data of the job. • Any other data required. • WS-Resource operations: • Operations over the resource properties. • Operations over the resource lifetime. • Other specific operations for the Grid. • Grid requirements: • All operations over the Grid must be executed as an authenticated user in the User Interface. • Operation mode must be asynchronous (edg-job-submit, edg-job-status, edg-jog-get-output). • It is not necessary to create an asynchronous behavior, only move it from the Grid to the WSRF services. Web Services over the Grid
createResource(username, password) EPR – Resource ID SetResourceProperty(myName) submitJob() GetResourceProperty(status) collectResults() GetMultipleResourceProperties(stdout, stderr, response) Destroy() Simple Hello World Grid WSRF service GridHello World WS-Resource username username password password myName myName status status response response stdout stdout stderr stderr Web Services over the Grid
Outline • Generic Web Services problem • Web Services Resource Framework (WSRF) • WS-Addressing • Faults • Declaring WS-Resource properties • Operations over WS-Resource properties • WS-Resource lifetime • Grouping services • Developing WSRF services • WSRF::Lite • wsrf4egee Web Services over the Grid
WS-Addressing • The key concept in WS-Addressing is the Endpoint Reference (EPR): • An EPR is a URL wrapped by some XML elements which represents the location of a Web Service: • An EPR allows to include additional information in a SOAP request that helps uniquely identify a Web Service instance • EPR’s are used by WSRF for representing references to WS-Resources. • EPR’s vs. URL’s. Why EPR’s are necessary? • Appending something like ?resourceID=123 to the URL is not very SOAP-ish. • It’s better to use additional SOAP headers. • Web Service specific data is not bound to one specific transport protocol. • Web Service specific data is all inside the SOAP envelope (not in different levels, one at the transport level and other at SOAP level). Web Services over the Grid
WS-Addressing • Endpoint Reference format: • wsa:Address • Specifies the URL that should be used when trying to talk to the Web Service. • wsa:ReferenceProperties • Encapsulates all Web service-specific data (reference properties), such as a session identifier, an instance identifier or a resource identifier. <widget:myLocationEPR> <wsa:Address>http://localhost/WidgetService</wsa:Address> <wsa:ReferenceProperties> <widget:resourceID>123</widget:resourceID> </wsa:ReferenceProperties> </widget:myLocationEPR> Web Services over the Grid
WS-Addressing • An EPR should be returned at some point of a Web Service: • When creating an instance to the Web Service. • Asking for a pointer to an instance to the Web Service. <soap:Envelope...> <soap:Body> <widget:createWidgetResponse...> <widget:widgetReference> <wsa:Address>http://host/WidgetService</wsa:Address> <wsa:ReferenceProperties> <widget:resourceID>123</widget:resourceID> </wsa:ReferenceProperty> </widget:widgetReference> </widget:createWidgetResponse> </soap:Body> </soap:Envelope> Web Services over the Grid
WS-Addressing • Subsequent invocations to the instance of a Web Service referred by an EPR must integrate the information of that EPR in the SOAP header: • wsa:To • SOAP message information header which indicates the target Web Service’s URL. • It should be the same value as the wsa:Address element of the associated EPR. <soap:Envelope...> <soap:Header> <wsa:To> http://host/WidgetService </wsa:To> <widget:resourceID>123</widget:resourceID> </soap:Header> <soap:Body> ... </soap:Body> </soap:Envelope> Web Services over the Grid
WS-Addressing • Other SOAP message information headers: • wsa:From • Indicates the EPR of the message's sender. • If the message's receiver needs to send a message back to the endpoint that sent the message, then it should use this EPR. • wsa:ReplyTo • Indicates the EPR to where the response message should go. <wsa:From> <wsa:Address> http://client/myClient </wsa:Address> </wsa:From> <wsa:ReplyTo> <wsa:Address> http://client/myReceiver </wsa:Address> </wsa:ReplyTo> Web Services over the Grid
WS-Addressing • …other SOAP message information headers: • wsa:FaultTo: • Indicates the EPR to where a fault should go if the response to a message is a SOAP fault. • wsa:MessageID: • Is a URI that uniquely identifies a message. • wsa:Action: • Makes reference to the operation that must be carried out. <wsa:FaultTo> <wsa:Address> http://client/FaultCatcher </wsa:Address> </wsa:FaultTo> <wsa:MessageID>uuid:098765</wsa:MessageID> <wsa:Action> http://host/widgetOp </wsa:Action> Web Services over the Grid
WS-Addressing • …other SOAP message information headers: • wsa:RelatesTo: • Is used on response messages to indicate that it is related to a previously-known message and to define that relationship. • In all of the headers that either contain an Address element or are, like the To header, an address themselves, you can use a special anonymous URI: • http://schemas.xmlsoap.org/ws/2003/03/addressing/role/anonymous • Indicates that there is no real endpoint available for this address. <wsa:RelatesTo RelationshipType="wsa:Response"> uuid:098765 </wsa:RelatesTo> Web Services over the Grid
Outline • Generic Web Services problem • Web Services Resource Framework (WSRF) • WS-Addressing • Faults • Declaring WS-Resource properties • Operations over WS-Resource properties • WS-Resource lifetime • Grouping services • Developing WSRF services • WSRF::Lite • wsrf4egee Web Services over the Grid
Base faults • WSRF defines a set of rules for exchanging faults messages through WS-BaseFaults specification. • WS-BaseFaults defines a XML schema type for a base fault. • The base fault has the following syntax: <BaseFault> {any}* <Timestamp>xsd:dateTime</Timestamp> <OriginatorReference> wsa:EndpointReferenceType </OriginatorReference> ? <ErrorCode dialect="anyURI">xsd:anyType</ErrorCode> ? <Description>xsd:string</Description> * <FaultCause>{any}</FaultCause> ? </BaseFault> Web Services over the Grid
Faults • All faults must use the following URI inside the wsa:Action • http://docs.oasis-open.org/wsrf/fault • A WSRF service supports the following base faults: • ResourceUnknownFault • The resource identified in the message is not known to the Web service. • ResourceUnavailableFault • The resource identified in the message is unavailable. Web Services over the Grid
Faults Example SOAP 1.1 Encoding of a Base Fault Web Services over the Grid
Outline • Generic Web Services problem • Web Services Resource Framework (WSRF) • WS-Addressing • Faults • Declaring WS-Resource properties • Operations over WS-Resource properties • WS-Resource lifetime • Grouping services • Developing WSRF services • WSRF::Lite • wsrf4egee Web Services over the Grid
Declaring WS-Resource Properties • One characteristic of a WS-Resource is the set of properties associated with the resource. • The definition of the properties of a WS-Resource MAY be declared as part of a Web Service interface: • The declaration of the WS-Resource’s properties represents a projection of a view of the WS-Resource’s state. • This projection is defined in terms of a resource properties document: • The resource properties document definition is associated with a Web service WSDL portType in the following manner: <wsdl:defintions …> <wsdl:portType … wsrf-rp:ResourceProperties=”xsd:QName”? … > … </wsdl:portType> Web Services over the Grid
Declaring Resource Properties WSDL example Web Services over the Grid
Outline • Generic Web Services problem • Web Services Resource Framework (WSRF) • WS-Addressing • Faults • Declaring WS-Resource properties • Operations over WS-Resource properties • WS-Resource lifetime • Grouping services • Developing WSRF services • WSRF::Lite • wsrf4egee Web Services over the Grid
Operations over WS-Resource Properties • WSFR defines a standard set of message exchanges or operations that allow a requestor to query or update the property values of a WS-Resource: • GetResourcePropertyDocument (optional) • GetResourceProperty (mandatory) • GetMultipleResourceProperties (optional) • QueryResourceProperties (optional) • PutResourcePropertyDocument (optional) • SetResourceProperties (optional) • InsertResourceProperties (optional) • UpdateResourceProperties (optional) • DeleteResourceProperties (optional) Web Services over the Grid
GetResourcePropertyDocument • Allows a requestor to retrieve the values of all resource properties associated with the WS-Resource. • Request: • wsa:Action=http://docs.oasis-open.org/wsrf/rpw-2/GetResourcePropertyDocument/GetResourcePropertyDocumentRequest • Response: • wsa:Action=http://docs.oasis-open.org/wsrf/rpw-2/GetResourcePropertyDocument/GetResourcePropertyDocumentResponse • Faults: • Generic WS-Resource faults. <wsrf-rp:GetResourcePropertyDocument /> <wsrf-rp:GetResourcePropertyDocumentResponse> {any} </wsrf-rp:GetResourcePropertyDocumentResponse> Web Services over the Grid
Resource properties document Response Request GetResourcePropertyDocument Web Services over the Grid
GetResourceProperty • Allows a requestor to retrieve the value of a single resource property of a WS-Resource. • Request: • wsa:Action=http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyRequest • Response: • wsa:Action=http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyResponse <wsrf-rp:GetResourceProperty> QName </wsrf-rp:GetResourceProperty> <wsrf-rp:GetResourcePropertyResponse> {any}* </wsrf-rp:GetResourcePropertyResponse> Web Services over the Grid
GetResourceProperty • Faults: • Generic WS-Resource faults. • InvalidResourcePropertyQNameFault: • The QName in the request message did not correspond to a resource property element of the WS-Resource referred to in the request message. Web Services over the Grid
Request Response GetResourceProperty Web Services over the Grid
GetMultipleResourceProperties • Allows a requestor to retrieve the values of multiple resource properties of a WS-Resource. • Request: • wsa:Action=http://docs.oasis-open.org/wsrf/rpw-2/GetMultipleResourceProperties/GetMultipleResourcePropertiesRequest • Response: • wsa:Action=http://docs.oasis-open.org/wsrf/rpw-2/GetMultipleResourceProperties/GetMultipleResourcePropertiesResponse <wsrf-rp:GetMultipleResourceProperties> <wsrf-rp:ResourceProperty>QName<wsrf-rp:ResourceProperty>+ </wsrf-rp:GetMultipleResourceProperties> <wsrf-rp:GetMultipleResourcePropertiesResponse> {any}* </wsrf-rp:GetMultipleResourcePropertiesResponse> Web Services over the Grid
GetMultipleResourceProperties • Faults: • Generic WS-Resource faults. • InvalidResourcePropertyQNameFault: • One or more of the QNames in the request message did not correspond to a resource property element of the WS-Resource referred to in the request message. Web Services over the Grid
Request Response GetMultipleResourceProperties Web Services over the Grid
QueryResourceProperties • Allows a requestor to query the resource properties document of a WS-Resource using a query expression such as XPath. • Supporting XPath dialect is mandatory: • http://www.w3.org/TR/1999/REC-xpath-19991116 • Request: • wsa:Action=http://docs.oasis-open.org/wsrf/rpw-2/QueryResourceProperties/QueryResourcePropertiesRequest • Response: • wsa:Action=http://docs.oasis-open.org/wsrf/rpw-2/QueryResourceProperties/QueryResourcePropertiesResponse <wsrf-rp:QueryResourceProperties> <wsrf-rp:QueryExpression Dialect=”xsd:anyURI”> xsd:any </wsrf-rp:QueryExpression> </wsrf-rp:QueryResourceProperties> <wsrf-rp:QueryResourcePropertiesResponse> {any} </wsrf-rp:QueryResourcePropertiesResponse> Web Services over the Grid
QueryResourceProperties • Faults: • Generic WS-Resource faults. • UnknownQueryExpressionDialectFault • The given QueryExpression has a dialect that is unknown to the Web service. • InvalidQueryExpressionFault • The given QueryExpression is not valid within the QueryExpression language identified by the dialect attribute. Web Services over the Grid
Request Response QueryResourceProperties Web Services over the Grid
PutResourcePropertyDocument • Allows a requestor to completely replace the values of a WS-Resource’s properties with an entirely new resource property document. • Request: • wsa:Action=http://docs.oasis-open.org/wsrf/rpw-2/PutResourcePropertyDocument/PutResourcePropertyDocumentRequest • Response: • wsa:Action=http://docs.oasis-open.org/wsrf/rpw-2/PutResourcePropertyDocument/PutResourcePropertyDocumentResponse <wsrf-rp:PutResourcePropertyDocument> {any} </wsrf-rp:PutResourcePropertyDocument> <wsrf-rp:PutResourcePropertyDocumentResponse> {any} ? </wsrf-rp:PutResourcePropertyDocumentResponse> Web Services over the Grid
PutResourcePropertyDocument • Faults: • Generic WS-Resource faults. • UnableToPutResourcePropertyDocumentFault • The WS-Resource was unable to complete the processing of the PutResourcePropertyDocument for some reason. Web Services over the Grid
Request Response PutResourcePropertyDocument Web Services over the Grid
SetResourceProperties • Allows the processing of a single request message to make multiple changes to the resource properties document. • Types of changes: • Insert: • wherein a new resource property element is inserted into the resource properties document • Update: • wherein existing resource property element(s) are modified • Delete: • wherein existing resource property element(s) are removed Web Services over the Grid
SetResourceProperties • Request: • wsa:Action=http://docs.oasis-open.org/wsrf/rpw-2/SetResourceProperties/SetResourcePropertiesRequest • Response: • wsa:Action=http://docs.oasis-open.org/wsrf/rpw-2/SetResourceProperties/SetResourcePropertiesResponse <wsrf-rp:SetResourceProperties> [ <wsrf-rp:Insert > {any}* </wsrf-rp:Insert> | <wsrf-rp:Update > {any}* </wsrf-rp:Update> | <wsrf-rp:Delete ResourceProperty=”QName” /> ]+ </wsrf-rp:SetResourceProperties> <wsrf-rp:SetResourcePropertiesResponse> </wsrf-rp:SetResourcePropertiesResponse> Web Services over the Grid
SetResourceProperties • Faults: • Generic WS-Resource faults. • InvalidModificationFault • The contents of the SetResourceProperties request component cause the resource properties document to no longer be able to validate. • UnableToModifyResourcePropertyFault • A resource property identified by one of the SetResourceProperties request components is read-only. • InvalidResourcePropertyQNameFault • A resource property QName does not identify a resource property. • SetResourcePropertyRequestFailedFault • One or more components of the SetResourceProperties request failed. Web Services over the Grid
SetResourceProperties • Any fault message indicating a failure during the update of the resource properties document must also indicate whether the document was restored or not by using the ResourcePropertyChangeFailure element of the fault: • Indicates the resource property element change associated with the fault. • Indicates if the resource property document as a whole was restored <wsrf-rp:ResourcePropertyChangeFailure Restored=xsd:boolean?> <wsrf-rp:CurrentValue>{any}*</wsrf-rp:CurrentValue> ? <wsrf-rp:RequestedValue>{any}*</wsrf-rp:RequestedValue> ? </wsrf-rp:ResourcePropertyChangeFailure> Web Services over the Grid
Request Change failure Response SetResourceProperties Web Services over the Grid
InsertResourceProperties • Request the insertion of one or more element values of a single resource property into the resource properties document of a WS-Resource. • Request: • wsa:Action=http://docs.oasis-open.org/wsrf/rpw-2/InsertResourceProperties/InsertResourcePropertiesRequest. • Response: • wsa:Action=http://docs.oasis-open.org/wsrf/rpw-2/InsertResourceProperties/InsertResourcePropertiesResponse. <wsrf-rp:InsertResourceProperties> <wsrf-rp:Insert> {any}* </wsrf-rp:Insert> </wsrf-rp:InsertResourceProperties> <wsrf-rp:InsertResourcePropertiesResponse> </wsrf-rp:InsertResourcePropertiesResponse> Web Services over the Grid
InsertResourceProperties • Faults: • Generic WS-Resource faults. • InvalidModificationFault • The contents of the InsertResourceProperties request component cause the resource properties document to no longer be able to validate. • UnableToModifyResourcePropertyFault • A resource property identified by the InsertResourceProperties request is not modifiable. • InvalidResourcePropertyQNameFault • A resource property QName does not identify a resource property. • InsertResourcePropertiesRequestFailedFault • The InsertResourceProperties request failed for some reason. • Use the ResourcePropertyChangeFailure element of the fault if failure during the update. Web Services over the Grid