+ All Categories
Home > Documents > 4c.1 Grid Computing, B. Wilkinson, 2005 Web Service Resource Framework Creating Globus 4 services.

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

Date post: 28-Dec-2015
Category:
Upload: stephanie-mcbride
View: 217 times
Download: 1 times
Share this document with a friend
Popular Tags:
50
4c.1 Grid Computing, B. Wilkinson, 2005 Web Service Resource Framework Creating Globus 4 services
Transcript
Page 1: 4c.1 Grid Computing, B. Wilkinson, 2005 Web Service Resource Framework Creating Globus 4 services.

4c.1Grid Computing, B. Wilkinson, 2005

Web Service Resource Framework

Creating Globus 4 services

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

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.

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

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.

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

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.

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

4c.5

Web Service

Resource

Resource properties

Client

Web Service Resource Framework(WS-RF)

Holds information retained between accesses.

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

4c.6

Key XML files needed for implementing service

• WSDL file – defines the service interface.

• Deployments files:– WSDD deployment file– JNDI deployment file

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

4c.7

Web Service

Resource

Resource properties

Client

Holds information retained between accesses.

Service interface fileWSDL file

Deployment filesWSDD, JNDI files

Container

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

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.

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

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.

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

4c.10

Service implementation

• If service uses WSRF mechanisms, implementation must include code for resource implementation and resource home.

• Resource home – manages resources

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

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

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

4c.12

WSDL file used for GT 4 service in Assignment 2

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

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).

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

4c.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" />

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

4c.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"/>

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

4c.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>

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

4c.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>

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

4c.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>

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

4c.19

Service Code

The code has two major parts:

• Resource properties• Service code (methods)

which are combined into one file for this assignment.

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

4c.20

Service – Resource Propertiespublic 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

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

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.

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

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

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

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; }

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

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.

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

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.

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

4c.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>

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

4c.27

<service name="examples/core/first/MathService" provider="Handler" use="literal" style="document">

specifies where the service will be located.

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

4c.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>

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

4c.29

Steps for developing GT4 service

1. Define service interface using WSDL2. Implement service

• Include routines for associated resources

3. Define deployment using WSDD file4. Compile everything.5. Deploy service, either using:

– GT4 globus-build-service script, or – ant directly

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

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.

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

4c.31

GT 4 build command

globus-build-service

Contains bash and ant files, see globus service build tools:

http://gsbt.sourceforge.net

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

4c.32

Resource Home

• Resources are managed by “Resource Homes”

• Provides an interface for adding and removing resources

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

4c.33

Resource Home

Client Web Service

Resource home

Resource

Manages

Methods operate on resources properties

create/find resource

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

4c.34

Resource Home

Client Web Service

Resource home

Resource

Previously, service and resource in one fileand resource home limited to one resource,using ServiceResourceHome class

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

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.

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

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.

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

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

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

4c.38

Lifecycle ManagementGT4 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.

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

4c.39

Notifications

• Informing clients to be notified when something interesting happens.

• Example in assignment 2a

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

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

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

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

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

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

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

4c.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>

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

4c.44

Reference Properties <wsa:ReferenceProperties> tag

• Can be used to identify a resource properties in WSRF

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

4c.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>

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

4c.46

SOAP message

WS-Addressing requires that contents of:

• <wsa:Address>

• <wsa:ReferenceProperties>

must appear in SOAP’s header.

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

4c.47

Soap messageAddress 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>

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

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.

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

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

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

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.


Recommended