Download presentation
Presentation is loading. Please wait.
Published byStephanie McBride Modified over 9 years ago
1
4c.1 Grid Computing, B. Wilkinson, 2005 Web Service Resource Framework Creating Globus 4 services
2
4c.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
4c.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
4c.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
4c.5 Web Service Resource Resource properties Client Web Service Resource Framework (WS-RF) Holds information retained between accesses.
6
4c.6 Key XML files needed for implementing service WSDL file – defines the service interface. Deployments files: –WSDD deployment file –JNDI deployment file
7
4c.7 Web Service Resource Resource properties Client Holds information retained between accesses. Service interface file WSDL file Deployment files WSDD, JNDI files Container
8
4c.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
4c.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
4c.10 Service implementation If service uses WSRF mechanisms, implementation must include code for resource implementation and resource home. Resource home – manages resources
11
4c.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
4c.12 WSDL file used for GT 4 service in Assignment 2
13
4c.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
4c.14 <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
4c.15 <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">
16
4c.16 <xsd:element ref="tns:Value“ minOccurs="1“ maxOccurs="1"/> <xsd:element ref="tns:LastOp“ minOccurs="1“ maxOccurs="1"/>
17
4c.17
18
4c.18 <portType name="MathPortType" wsdlpp:extends="wsrpw:GetResourceProperty" wsrp:ResourceProperties="tns:MathResourceProperties">
19
4c.19 Service Code The code has two major parts: Resource properties Service code (methods) which are combined into one file for this assignment.
20
4c.20 Service – 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 Resource properties
21
4c.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
4c.22 /* 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; } Service – Resource Properties methods
23
4c.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
4c.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
4c.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
4c.26 WSDD file <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"> <parameter name="className"value="org.globus.examples. services.core.first.impl.MathService"/> share/schema/examples/MathService_instance/Math_service.wsdl <parameter name="handlerClass“ value="org.globus.axis.providers.RPCProvider"/>
27
4c.27 specifies where the service will be located.
28
4c.28 JNDI deployment file <resource name="home“ type="org.globus.wsrf.impl.ServiceResourceHome"> factory org.globus.wsrf.jndi.BeanFactory
29
4c.29 Steps for developing GT4 service 1.Define service interface using WSDL 2.Implement service Include routines for associated resources 3.Define deployment using WSDD file 4.Compile everything. 5.Deploy service, either using: –GT4 globus-build-service script, or –ant directly
30
4c.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
4c.31 GT 4 build command globus-build-service Contains bash and ant files, see globus service build tools: http://gsbt.sourceforge.net
32
4c.32 Resource Home Resources are managed by “Resource Homes” Provides an interface for adding and removing resources
33
4c.33 Resource Home Client Web Service Resource home Resource Manages Methods operate on resources properties create/ find resource
34
4c.34 Resource Home Client Web Service Resource home Resource Previously, service and resource in one file and resource home limited to one resource, using ServiceResourceHome class
35
4c.35 Resource Home Client Web Service Resource home 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
4c.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
4c.37 Multiple services with a Factory Service Client Service instance Resource Home Resource Manages Methods operate on resources properties Find resource Factory Service Request resource creation Use Resource Home to create resource
38
4c.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
4c.39 Notifications Informing clients to be notified when something interesting happens. Example in assignment 2a
40
4c.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
4c.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
4c.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
4c.43 The minimum is simply the service address, using tag: http://www.cs.uncc.edu/axis/abw/Myservice.jws
44
4c.44 Reference Properties tag Can be used to identify a resource properties in WSRF
45
4c.45 WS-Addressing endpoint example http://www.cs.uncc.edu/axis/abw/Myservice.jws 28
46
4c.46 SOAP message WS-Addressing requires that contents of: must appear in SOAP’s header.
47
4c.47 Soap message Address appears in tag and ReferenceProperty in tag:. http://www.cs.uncc.edu/axis/abw/Myservice.jws 28..
48
4c.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
4c.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
4c.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.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.