1 notes adapted from barry wilkinson grid computing course uncc web service resource framework...

44
1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

Upload: amberlynn-mcbride

Post on 20-Jan-2016

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

1

Notes adapted from Barry Wilkinson

Grid Computing CourseUNCC

Web Service Resource Framework

Creating Globus 4 services

Page 2: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

2

Grid Computing

• Using distributed computers and resources collectively.

• Usually associated with geographically distributed computers and resources on a high speed network.

• Often about teams sharing resources.

Page 3: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

3

But grid computing can be more than this.

It offers the potential of virtual organizations – groups of people both geographically and

organizationally distributed working together on problems, sharing computers AND other resources such as databases and experimental equipment.

Page 4: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

4

Some “Computational” Grid Projects

• Large Hadron Collider experimental facility for complex particle experiments at CERN (European Center for Nuclear Research, near Geneva Switzerland).

• DOE Particle Physics Data grid

• DOE Science grid

• AstroGrid Project

• Comb-e-Chem project

Page 5: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

5

TeraGrid

Page 6: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

6

TeraGrid

Page 7: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

7

Grid computing

• With the use of the Internet interconnection technology, implementation now based upon Internet technologies.

• Now uses a form of web services.

• Enables using existing protocols, security mechanisms, etc.

Page 8: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

8

Web Services

• Software components designed to provide specific operations (“services”) accessible using standard Internet technology.

• For machine interaction over a network.

• Usually through SOAP (simple Object Access Protocol) messages carrying XML documents, and a HTTP transport protocol.

Page 9: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

9

Basic client-server model

Page 10: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

10

Key aspects

Has similarities with RMI and other distributed object technologies (CORBA etc.) but::

• Web Services are platform independent– They use XML within a SOAP message).– Most use HTTP to transmit message.

Page 11: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

11

XML Tags

• Not predefined as in HTML.

• Must define your own tags using names as names in a programming languages

• As in programming languages, restrictions. Case sensitive. Start with a letter.

• “Elements” have start and end tags.

• Start tags can have attributes as in HTML.

Page 12: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

12

Additional XML materialsOn-line materials

• W3C consortium home page:

http://www.w3.org/XML/

• W3Schools XML Tutorial :

http://www.w3schools.com/xml/

Page 13: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

13

Address of a Web Service

• URIs

Example (URL)

http://www.cs.wcu.edu/webservices/math1

This does not exist, and if did, would only be meaningful to software.

Page 14: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

14

Web Service Application

Page 15: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

15

Steps

• Client calls client stub.

• SOAP request sent across network

• Server stub receives request and sends request to service

• Service send result to serve stub

• Server stub sends result across network to client stub.

• Client stub sends result to client.

Page 16: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

16

Web Service Application

Call client stubSOAP

requestRequest service

Result returnedSOAP

responseClient receives result

Page 17: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

17

Web Service Definition Language (WSDL)

A W3C standard XML document that describes three fundamental properties of a service:

• What it is - operations (methods) it provides.• How it is accessed - data format, protocols.• Where it is located - protocol specific network

address.

Page 18: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

18

Parts of a WSDL Document

Parts of an WSDL document::• Root definitions - namespaces

• portType definitions - abstract definition of service

• Message definitions - parameters in method signature

• Type definitions - data types

• Binding definitions - to protocols I.e. SOAP over HTTP

• Service definitions - where service is, ports

Page 19: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

19

Grid service

The Global Grid Forum (GGF) developed standard interfaces, behaviors, core semantics, etc. for grid applications based upon web services.

GGF introduced the term Grid Service as an extended web service that conforms to the GGF OGSI standard.

Page 20: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

20

Globus Toolkit

• An implementation of the Open Grid Services Infrastructure (OGSI) standard, developed at Argonne National Laboratory and the University of Chicago

• Used in virtually all grids today

• We will be using Globus Toolkit 4 (GT4)

Page 21: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

21

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 22: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

22

Web Service

Resource

Resource properties

Client

Web Service Resource Framework(WS-RF)

Holds information retained between accesses.

Page 23: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

23

WSRF Programming Assignment

Goal: 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 24: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

24

Resource Properties

In the code provided in the assignment, there are actually two resource properties:

• Value -- an integer acted upon by the operations: add, sub, and getValueRP

and

• “Last operation performed” -- a string holding the name of the last operation done, addition or subtraction, which is not used in assignment 2

Page 25: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

25

Math Web Service

Resource

Resource properties“value”

(integer)

“last operationperformed”

(string)

Client

Assignment Resource Properties

Page 26: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

26

Key XML files needed for implementing service

• WSDL file – defines the service interface.

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

Page 27: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

27

Steps in the assignment

0. Setting up the environment1. Defining the interface in WSDL2. Implementing the service in Java3. Configuring the deployment in WSDD4. Build the Math service (Create a GAR file)5. Deploy the Math service6. Write and compile the client7. Start the container and execute the clientAll of the above steps are mostly done for you!8. Add functionality to the service

Page 28: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

28

Running the tutorial

• An illustration of running the tutorial on your Windows computer can be found at:

• http://csce.uark.edu/~aapon/courses/cluster/homework/tutorial.doc

• http://csce.uark.edu/~aapon/courses/cluster/homework/tutorial.pdf

Page 29: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

29

WSDL file used for GT 4 service in the programming

assignment

Page 30: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

30

<?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 31: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

31

<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 32: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

32

<!-- 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 33: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

33

<!- 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 34: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

34

<!-- 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 35: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

35

Service Code

The code has two major parts:

• Resource properties• Service code (methods)

which are combined into one file for this assignment.

Page 36: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

36

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 37: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

37

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 38: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

38

/* 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 39: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

39

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 40: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

40

Deploying a GT 4 service

• The GT 4 container uses Apache Axis

• A Java container for executing a Java servlet

Page 41: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

41

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 42: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

42

GT 4 build command

globus-build-service

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

http://gsbt.sourceforge.net

Page 43: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

43

Step 8: Extend the Functionality of the Service

This is your assignment!

Add a multiply method to your Math Service.

Repeat all the steps to test it.

Page 44: 1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services

44

More Information

• GGF: http://www.ggf.org

• GT4 services tutorial:

http://gdp.globus.org/gt4-tutorial/(Slides and assignment based upon this tutorial)

• GT4 tutorial by Foster:http://www.globus.org/toolkit/docs/4.0/key/GT4_Primer_0.6.pdf