1 / 50

Grid Computing, B. Wilkinson, 2005

Web Service Resource Framework Creating Globus 4 services. Grid Computing, B. Wilkinson, 2005. GT 4 services. Key aspect is the separation of the (web) service and a resource – conceptually if not actually.

gerek
Download Presentation

Grid Computing, B. Wilkinson, 2005

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Web Service Resource Framework Creating Globus 4 services Grid Computing, B. Wilkinson, 2005

  2. GT 4 services • Key aspect is the separation of the (web) service and a resource – conceptually if not actually. • Provides the ability to have “state” without altering the statelessness of a web service.

  3. Example with a “database” resource The Grid 2: Blueprint for a new Computing Infrastructure, Ian Foster, Carl Kesselman and Steve Tuecker Editors, Morgan Kaufmann 2004 -- Chapter 17: “The Open Grid Service Architecture,” by Ian Foster, Carl Kesselman and Steve Tuecker.

  4. In this example, the client accesses a file transfer service to perform actions such as transfer a file from one storage service to another. • Because based upon web services, uses web services technology, XML, WSDL, etc.

  5. Web Service Resource Framework (WS-RF) Resource Web Service Resource properties Holds information retained between accesses. Client

  6. Key XML files needed for implementing service • WSDL file – defines the service interface. • Deployments files: • WSDD deployment file • JNDI deployment file

  7. Container Deployment files WSDD, JNDI files Resource Service interface file WSDL file Web Service Resource properties Holds information retained between accesses. Client

  8. WSDL file • Serves the same purpose as the WSDL file in web services – to define the service interface. • A significant addition in the WSDL file is to specify the resource.

  9. Service interface • If service implements operations on WSRF resource properties, WSDL will include definitions relating to resource property. • The binding component to specify how abstract interface maps to concrete protocol messages generated by GT4 automatically.

  10. Service implementation • If service uses WSRF mechanisms, implementation must include code for resource implementation and resource home. • Resource home – manages resources

  11. Globus-specific features of WSDL • Resource properties – specified in portType attribute wsrp:ResourceProperties • WSDL preprocessor used to include WSRF definitions (portType attribute wsdlpp:extends). • Bindings – not needed in WSDL because automatically inserted by GT4 when built Developed from page 31 of Sotomaytor’s GT4 tutorial

  12. WSDL file used for GT 4 service in Assignment 2

  13. Purpose of Service in Assignment 2 To store an integer value which can be acted upon by methods to: • Get its value • Increment its value (add one), and • Decrement its value (subtract one). The service is stateful (the value is retained between accesses).

  14. <?xml version="1.0" encoding="UTF-8"?> <definitions name="MathService" targetNamespace=http://www.globus.org/namespaces/examples/core/ MathService_instance xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns=http://www.globus.org/namespaces/examples/core/ MathService_instance xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsrp="http://docs.oasis-open.org/wsrf/2004/06/ wsrf-WS-ResourceProperties-1.2-draft-01.xsd" xmlns:wsrpw="http://docs.oasis-open.org/wsrf/2004/06/ wsrf-WS-ResourceProperties-1.2-draft-01.wsdl" xmlns:wsdlpp="http://www.globus.org/namespaces/2004/10/ WSDLPreprocessor" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <wsdl:import namespace= "http://docs.oasis-open.org/wsrf/2004/06/ wsrf-WS-ResourceProperties-1.2-draft-01.wsdl" location="../../wsrf/properties/WS-ResourceProperties.wsdl" />

  15. <types> <xsd:schema targetNamespace="http://www.globus.org/namespaces/examples/core/ MathService_instance" xmlns:tns="http://www.globus.org/namespaces/examples/core/ MathService_instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <!-- REQUESTS AND RESPONSES --> <xsd:element name="add" type="xsd:int"/> <xsd:element name="addResponse"> <xsd:complexType/> </xsd:element> <xsd:element name="subtract" type="xsd:int"/> <xsd:element name="subtractResponse"> <xsd:complexType/> </xsd:element> <xsd:element name="getValueRP"> <xsd:complexType/> </xsd:element> <xsd:element name="getValueRPResponse" type="xsd:int"/>

  16. <!-- RESOURCE PROPERTIES --> <xsd:element name="Value" type="xsd:int"/> <xsd:element name="LastOp“ type="xsd:string"/> <xsd:element name="MathResourceProperties"> <xsd:complexType> <xsd:sequence> <xsd:element ref="tns:Value“ minOccurs="1“ maxOccurs="1"/> <xsd:element ref="tns:LastOp“ minOccurs="1“ maxOccurs="1"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> </types>

  17. <!- M E S S A G E S--> <message name="AddInputMessage"> <part name="parameters" element="tns:add"/> </message> <message name="AddOutputMessage"> <part name="parameters" element="tns:addResponse"/> </message> <message name="SubtractInputMessage"> <part name="parameters" element="tns:subtract"/> </message> <message name="SubtractOutputMessage"> <part name="parameters" element="tns:subtractResponse"/> </message> <message name="GetValueRPInputMessage"> <part name="parameters" element="tns:getValueRP"/> </message> <message name="GetValueRPOutputMessage"> <part name="parameters" element="tns:getValueRPResponse"/> </message>

  18. <!-- P O R T T Y P E--> <portType name="MathPortType" wsdlpp:extends="wsrpw:GetResourceProperty" wsrp:ResourceProperties="tns:MathResourceProperties"> <operation name="add"> <input message="tns:AddInputMessage"/> <output message="tns:AddOutputMessage"/> </operation> <operation name="subtract"> <input message="tns:SubtractInputMessage"/> <output message="tns:SubtractOutputMessage"/> </operation> <operation name="getValueRP"> <input message="tns:GetValueRPInputMessage"/> <output message="tns:GetValueRPOutputMessage"/> </operation> </portType> </definitions>

  19. Service Code The code has two major parts: • Resource properties • Service code (methods) which are combined into one file for this assignment.

  20. Service – Resource Properties Resource properties public class MathService implements Resource, ResourceProperties { private ResourcePropertySet propSet; /* Resource Property set */ private int value; private String lastOp; public MathService() throws RemoteException { /* RP Constructor */ this.propSet = new SimpleResourcePropertySet( MathQNames.RESOURCE_PROPERTIES); /* Create RP set */ try { /* Initialize the RP's */ ResourceProperty valueRP = new ReflectionResourceProperty( MathQNames.RP_VALUE, "Value", this); this.propSet.add(valueRP); setValue(0); ResourceProperty lastOpRP = new ReflectionResourceProperty( MathQNames.RP_LASTOP, "LastOp", this); this.propSet.add(lastOpRP); setLastOp("NONE"); } catch (Exception e) { throw new RuntimeException(e.getMessage()); } } Resource Property code

  21. Resource and ResourceProperty interfaces • Resource – a way of tagging a class as being a resource. This interface does not require any methods. • ResourceProperty – interface representing a single resource property • ReflectionResourceProperty -- A GT4 class, one of the ways one can represent a resource property in GT 4.

  22. Service – Resource Properties methods /* Get/Setters for the RPs */ public int getValue() { return value; } public void setValue(int value) { this.value = value; } public String getLastOp() { return lastOp; } public void setLastOp(String lastOp) { this.lastOp = lastOp; }

  23. Service code - methods /* Remotely-accessible operations */ public AddResponse add(int a) throws RemoteException { value += a; lastOp = "ADDITION"; return new AddResponse(); } public SubtractResponse subtract(int a) throws RemoteException { value -= a; lastOp = "SUBTRACTION"; return new SubtractResponse(); } public int getValueRP(GetValueRP params) throws RemoteException { return value; } /* Required by interface ResourceProperties */ public ResourcePropertySet getResourcePropertySet() { return this.propSet; }

  24. Deploying a GT 4 service • The GT 4 container uses Apache Axis and the basic steps for deploying a service are similar to that described earlier for Apache Axis in assignment 1, with some slight differences.

  25. Deployment files • server-config.wsdd (Web Service Deployment Descriptor) - contains information about the web service. jndi-config.xml (JNDI configuration file) - contains information about the resource management.

  26. WSDD file <?xml version="1.0" encoding="UTF-8"?> <deployment name="defaultServerConfig" xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <service name="examples/core/first/MathService" provider="Handler" use="literal" style="document"> <parameter name="className"value="org.globus.examples. services.core.first.impl.MathService"/> <wsdlFile>share/schema/examples/MathService_instance/Math_service.wsdl </wsdlFile> <parameter name="allowedMethods" value="*"/> <parameter name="handlerClass“ value="org.globus.axis.providers.RPCProvider"/> <parameter name="scope" value="Application"/> <parameter name="providers" value="GetRPProvider"/> <parameter name="loadOnStartup" value="true"/> </service> </deployment>

  27. <service name="examples/core/first/MathService" provider="Handler" use="literal" style="document"> specifies where the service will be located.

  28. JNDI deployment file <?xml version="1.0" encoding="UTF-8"?> <jndiConfig xmlns="http://wsrf.globus.org/jndi/config"> <service name="examples/core/first/MathService"> <resource name="home“ type="org.globus.wsrf.impl.ServiceResourceHome"> <resourceParams> <parameter> <name>factory</name> <value>org.globus.wsrf.jndi.BeanFactory</value> </parameter> </resourceParams> </resource> </service> </jndiConfig>

  29. Steps for developing GT4 service • Define service interface using WSDL • Implement service • Include routines for associated resources • Define deployment using WSDD file • Compile everything. • Deploy service, either using: • GT4 globus-build-service script, or • ant directly

  30. ant(Another Neat Tool) • A build tool used in this assignment for deploying service. • Similiar to the make program but the dependencies are specified using XML configuration files.

  31. GT 4 build command globus-build-service Contains bash and ant files, see globus service build tools: http://gsbt.sourceforge.net

  32. Resource Home • Resources are managed by “Resource Homes” • Provides an interface for adding and removing resources

  33. Resource Home Resource home create/ find resource Web Service Client Manages Methods operate on resources properties Resource

  34. Resource Home Resource home Web Service Client Resource Previously, service and resource in one file and resource home limited to one resource, using ServiceResourceHome class

  35. Resource Home Resource home Web Service Client Resource Separating service and resource in different file, have 3 files the service, the resource home, and the resource. Implement by extending SingletonResourceHome class.

  36. Multiple Resources • Can use a service called a factory service for creating resources • Each resource will be assigned a unique “key” which together with the service EPR identifies the WS-resource pair.

  37. Multiple services with a Factory Service Factory Service Use Resource Home to create resource Request resource creation Resource Home Find resource Service instance Client Manages Methods operate on resources properties Resource

  38. Lifecycle Management GT4 provides mechanisms to specify when a resource is destroyed: • Immediately by invoking destroy operation • Scheduled some time in the future • leased-based lifecycle management • Lease periodically renewed otherwise resource destroyed within a specified time.

  39. Notifications • Informing clients to be notified when something interesting happens. • Example in assignment 2a

  40. WS-Addressing • A way of identifying a web service and resource • More versatile that using URIs • Address of a WS-resource pair is called an endpoint reference (EPR) • In assignment 2 example EPR just the service URL because single resource

  41. WS-Addressing Terms Endpoint – the destination where the web service can be accessed. Endpoint reference, EPR –describes the destination, and includes the destination location as URI, but can have other parameters

  42. Endpoint reference, EPR Like all WS-* specs, defined in terms of XML. Defined as complex type. Can contain: • Address (a URI) (required) • Reference Properties • Reference Parameters • Port type • Service name • Policy elements Corresponds to portType and service of WSDL document

  43. The minimum is simply the service address, using <wsa:Address> tag: <wsa:EndpointReference> <wsa:Address> http://www.cs.uncc.edu/axis/abw/Myservice.jws </wsa:Address> </wsa:EndpointReference>

  44. Reference Properties <wsa:ReferenceProperties> tag • Can be used to identify a resource properties in WSRF

  45. WS-Addressing endpoint example <wsa:EndpointReference> <wsa:Address> http://www.cs.uncc.edu/axis/abw/Myservice.jws </wsa:Address> <wsa:ReferenceProperties> <resourceID>28</resourceID> </wsa:ReferenceProperties> </wsa:EndpointReference>

  46. SOAP message WS-Addressing requires that contents of: • <wsa:Address> • <wsa:ReferenceProperties> must appear in SOAP’s header.

  47. Soap message Address appears in <To> tag and ReferenceProperty in <resourceID> tag: <soap:Envelop> <soap:Header> . . . <wsa:To>http://www.cs.uncc.edu/axis/abw/Myservice.jws</wsa:To> <resourceID>28</resourceID> . . . </soap:Header> <soap:Body> . . . </soap:Body> </soap:Envelop>

  48. Implied WS-Resource Pattern • Describes a specific relationship between a web service and a resource. • When a client accesses a web service with an implied WS-Resource pattern, the service returns a WS-addressing endpoint reference.

  49. More Information • GGF: http://www.ggf.org • GT4 services: http://gdp.globus.org/gt4-tutorial/ (Slides and assignment 2 based upon this tutorial) • GT4 tutorial by Foster: http://www.globus.org/toolkit/docs/4.0/key/GT4_Primer_0.6.pdf

  50. Material in Books • The Grid 2: Blueprint for a new Computing Infrastructure, Ian Foster, Carl Kesselman and Steve Tuecker Editors, Morgan Kaufmann 2004 • Chapter 17: “The Open Grid Service Architecture,” by Ian Foster, Carl Kesselman and Steve Tuecker.

More Related