35
4d.1 Grid Computing, B. Wilkinson, 2005 Web Service Resource Framework Notes on “sticky note” assignment

4d.1 Grid Computing, B. Wilkinson, 2005 Web Service Resource Framework Notes on “sticky note” assignment

  • View
    219

  • Download
    1

Embed Size (px)

Citation preview

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

Web Service Resource Framework

Notes on “sticky note” assignment

4d.2

Environment

• Uses the Java GT4 core, which can be installed directly on a PC.

• Needs:– jdk, Java software development kit– ant, open source tool for building java code

4d.3

Sticky Note Service

• Represents a “sticky note as one might stick on the wall to give reminders.

• Resource property: a string containing the sticky note text

Assignment due

tomorrow

4d.4

Sticky Note Operations

• Operations:– Write text into a note – “write-note”

– Display the text of a note – “show-note”

– Create a note (introduced in Exercise 2)

4d.5

Exercise 1• Build sticky note service

• Deploy sticky note service. (Uses ant, not GT4 deploy command)

• Start GT4 container

• Execute a “show-note” client to use the show-note operation

4d.6

Building/Deploying service

• Uses command:

ant deploy

where deploy is an xml build file.

4d.7

Starting container

$ bin/globus-start-container -nosec

No Security -- Do not use GT 4 security mechanisms

4d.8

Starting SOAP server at: http://192.168.123.100:8080/wsrf/services/ With the following services:

[1]: http://192.168.123.100:8080/wsrf/services/InMemoryServiceGroupEntry[2]: http://192.168.123.100:8080/wsrf/services/TriggerFactoryService[3]: http://192.168.123.100:8080/wsrf/services/IndexFactoryService[4]: http://192.168.123.100:8080/wsrf/services/Version[5]: http://192.168.123.100:8080/wsrf/services/IndexService[6]: http://192.168.123.100:8080/wsrf/services/NotificationConsumerService[7]: http://192.168.123.100:8080/wsrf/services/DefaultTriggerServiceEntry[8]: http://192.168.123.100:8080/wsrf/services/TriggerServiceEntry[9]: http://192.168.123.100:8080/wsrf/services/IndexServiceEntry[10]: http://192.168.123.100:8080/wsrf/services/StickyNoteService[11]: http://192.168.123.100:8080/wsrf/services/AdminService[12]: http://192.168.123.100:8080/wsrf/services/DefaultIndexService[13]: http://192.168.123.100:8080/wsrf/services/DefaultIndexServiceEntry[14]: http://192.168.123.100:8080/wsrf/services/DefaultTriggerService[15]: http://192.168.123.100:8080/wsrf/services/ShutdownService[16]: http://192.168.123.100:8080/wsrf/services/ContainerRegistryService[17]: http://192.168.123.100:8080/wsrf/services/TriggerService[18]: http://192.168.123.100:8080/wsrf/services/gsi/AuthenticationService[19]: http://192.168.123.100:8080/wsrf/services/InMemoryServiceGroupFactory[20]: http://192.168.123.100:8080/wsrf/services/InMemoryServiceGroup[21]: http://192.168.123.100:8080/wsrf/services/ContainerRegistryEntryService[22]: http://192.168.123.100:8080/wsrf/services/SubscriptionManagerService

All https if security usedThe deployed StickyNote Servicce

4d.9

Executing show-note clientCommand:

$GLOBUS_LOCATION/bin/show-note -s http://localhost:8080/wsrf/services/StickyNoteService

Get:

<ns1:message

xmlns:ns1=http://tutorial.globus.org/stickynote

>hello.</ns1:message>

This is the message on the sticky note

4d.10

Executing write-note client

$GLOBUS_LOCATION/bin/write-note -s

http://localhost:8080/wsrf/services/StickyNoteService

cheese

Message written.

This is the text to be written in sticky note

4d.11

Exercise 2Creating a Resource

• In this exercise, you are asked to modify files to introduce the “create note” operation.

• Files to modify:– sticky note service wsdl file, to include the create note

operation– Sticky note service code, to include the create note

operation– jndi deployment configuration file

• Also create a “create-note” client

4d.12

Resource Home

• For managing resources.

• Must modify Resource Home from Exercise 1 so as to handle multiple resources.

• Done in deploy-jndi-conf.xml, by changing type of resource from “SingleNoteHome” to “ManyNoteHome” and associated details changed also.

4d.13

Creating a new note

$GLOBUS_LOCATION/bin/create-note -s http://localhost:8080/wsrf/services/StickyNoteServicenew note created...EPR written to file: note--1947556620.epr

To see note:

$GLOBUS_LOCATION/bin/show-note -e note--1947556620.epr<ns1:message xmlns:ns1=http://tutorial.globus.org/stickynote>hello.</ns1:message>

Endpoint Reference

4d.14

Sample file containing Endpoint Reference<StickyNoteEndpoint xsi:type="ns1:EndpointReferenceType"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:ns1="http://schemas.xmlsoap.org/ws/2004/03/addressing">

<ns1:Address

xsi:type="ns1:AttributedURI">http://192.168.1.100:8080/wsrf/

services/

StickyNoteService

</ns1:Address>

<ns1:ReferenceProperties “xsi:type="ns1:ReferencePropertiesType">

<ns1:NoteKey xmlns:ns1="http://sticky.com">25781085

</ns1:NoteKey>

</ns1:ReferenceProperties>

<ns1:ReferenceParameters xsi:type="ns1:ReferenceParametersType"/>

</StickyNoteEndpoint>

Resource “key”

4d.15

Sticky Note EPR

StickyNote service EPR1(service URI)

Resource property

Endpoint reference = EPR1 + resource “key”

KeyResource

“cheese”

With multiple resources, each resource assigned a unique key identifying it

4d.16

Exercise 3Destroying Resources

• Add an operation “destroy” in service wsdl file

• Add “DestroyProvider operation provider” in wsdd file

• Test by creating Sticky note and using GT4 “wsrf-destroy” command.

4d.17

Exercise 4Adding a resource property

• A “lastModified” resource property is added which records the time that the sticky note message was last altered.

• Requires 4 files to be modified:– wsdl file– Service code– A file containing constants– Client code to test it

4d.18

Exercise 5Register with a Local Index Service

• GT 4 provided with an index service that can maintain a list of available services.

• Index service acts as local service registry.

• In Exercise 5, the service is registered with the local GT 4 index service.

4d.19

Container

Index service

Multiple Sticky notes(resources with resource properties)

Note, the exercises asks each person to start their own container

4d.20

Details to use index service

• When resource created, “add” method of ResourceHome called.

• Need to override this method to include registering Resource with local index service.

• Need to modify ManyNoteHome.java

4d.21

Querying Index Servicewsrf-query

Browse index service with the GT4

wsrf-query command:

$GLOBUS_LOCATION/bin/wsrf-query -s http://localhost:8080/wsrf/services/DefaultIndexService '/*'

which will list the services in an XML format.

4d.22

Exercise 6Register with a “Community” Index Service

• A remote index service is used, which holds all the services of the “virtual organization.”

• For our purposes, the community index service is at:

http://beowulf.bear.uncw.edu:8080/wsrf/services/DefaultIndexService

4d.23

Local Index service

Sticky note resources

Community index service

beowulf.bear.uncw.edu:8080/wsrf/services/

DefaultIndexService

StickyNote service

client

4d.24

Implementation

• Configure local index to register with community index service.

• All local information, including service resource properties, copied to community index service.

4d.25

Implementation

Modify the file:

$GLOBUS_LOCATION/etc/globus_wsrf_mds_

index/hierarchy.xml

to include the URL of the community index service (<upstream> parameter)

4d.26

Querying Community Index Service

Have Community Index Service running.

Use wsrf-query command:

$GLOBUS_LOCATION/bin/wsrf-query -s http://beowulf.bear.uncw.edu:8080/wsrf/services/DefaultIndexService '/*'

Should see contents of all local index services.

4d.27

Local Index service

Resources

Service

client

Local Index service

Resources

Service

client

Student 1 Index entry

Student 2 Index entry

Student 1 container

Only container and GT 4 core needed at each site to handle services.

Student 2 container

Community index service

4d.28

Exercise 7Lease-based Lifetime

• In lease-based model, resources must be kept alive by interested parties, otherwise resource dies.

• Set a lifetime for a service after which the service is destroyed.

• Clean up without having to use a destroy operation explicitly.

4d.29

Termination TimeTermination time exposed as a resource property.

Can be set with GT4

wsrf-set-termination-time command.

Example

$GLOBUS_LOCATION/bin/wsrf-set-termination-time -e note--1234.epr 100

File containing EPR of resource (StickyNote)

Termination time in seconds

4d.30

Implementation

• Add subscribe operation to wsdl file.

• Add SubscribeProvider to wsdd file.

• Modify StickyNote.java

• Modify post-deploy.xml file

See exercise write-up for more details

4d.31

Exercise 8Notifications

• Notifications, generally, are a means by which a client can be informed of changes that have occurred such as:– Changes to resource property values.– Methods added– Methods removed– Resources destroyed

4d.32

In exercise 8, a second service, called watch-note, is used to display changes to the value of the StickyNote.

Client

StickyNote Service

watch-note

Different containerStickyNote resource property

Write note

Notification that note changed

4d.33

• In Exercise 8, a second service, called watch-note, is used to inform the client of changes to the value of the StickyNote.

• Need the client to “subscribe” to receive notifications.

• Subscriptions are for a particular topic.

4d.34

Exercise 9Resource Discovery

• In this exercise, the local and community index services are searched for a particular StickyNote message.

• Since Resources properties are XML, can use “XPath” queries for searching and retrieval.

• Uses a “XPath” query (apparently embedded in a script called search-note in this exercise)

4d.35

XML Path Language (XPath)

• W3C recommendation, 1999

• A query language for search XML documents.

• Queries formed by identifying a route to the desired data.

• For details: http://www.w3.org/TR/xpath