Building WSRF services - Dipartimento di Matematica e
Download
Report
Transcript Building WSRF services - Dipartimento di Matematica e
Building services in WSRF
Ben Clifford
Draft 2004-07-09
For GGF summer school, July
2004
outline
Webservices – should be covered by EGEE, so just one slide of concepts,
eg. WSDL without further expl.
WSRF – what WSRF adds – do we need to discuss why or will that be
covered in earlier sections? Eg. Carl’s intro?
Introduce WS-Resource
WS-Resource Properties
Exercise: stand up supplied installation and get running (maybe before
WS-Resource intro)
Exercise: talk to someone else’s service on a different laptop
Exercise: add a resource property to the service – add one which is ‘last
incremeted time’. Query own counters and query other peoples’ counters.
* Advanced students add another one of their choice.
Exercise: lifetime management: create new counters. Destroy old
counters.
Exercise: create a new counter resource and then register it to service
group – front screen will display fishies. (advanced exercise: if fish has a
FishName RP, use that instead of IP address)
2 hours exercise = 60 slides = 15 slides per module
Module 1
Overview
WSRF
Globus Alliance WSRF implementation
TODO: module 1 taught material should be
brief so that hands on happens soon –
could move some material to later on.
WSRF
WSRF is a framework consisting of a number of standards.
Resource Properties *
Lifetime management *
Service Groups
Notification
Faults
Renewable References (unpublished)
Other WS specifications such as:
WS-Addressing *
* will be talked about in this tutorial
How WS-RF fits in with other web
service standards.
TODO: chart with WSDL and SOAP, then
WSRF standards on top – maybe a slide in
WSRF into material?
Introduction to GT4 hosting env
Describe components
Container (TODO: slide with chart)
Clients
Build tools
(insert slides from sam’s tutorial here?)
WS-Resources
Already know what a web service is
Web services should be stateless
But there is often state in the system
A WS-Resource is a representation of some
state that can be accessed through web
services
In this tutorial we will be using ‘counter’
resources which are simple accumulators.
WS-Resources
WSRF specifications provide:
XML-based Resource Properties
Lifetime management (creation/destruction) of
resources
Servicegroups, which group together WSResources
Notification
(for example of changes in resource properties)
Faults
Renewable References
Web service
Web service
Web service with WS-Resource
Web Service with WS-Resources
Web Service with WS-Resources
WS-Resources
Examples of what could be a WSResouce?
Files on a file server
Rows in a database
Jobs in a job submission system
Accounts in a bank
In this tutorial, each resource is a counter.
Files used in the exercise
WSDL and XML Schema:
Counter port type
Java
CounterService.java
CounterHome.jav
Counter.java
Build.xml
Tells Ant how to build and deploy the code
Exercise 1
Exercise: stand up supplied installation and check it
works.
Steps:
Install software.
Start the container.
ant startContainer
Interact with container
show-counter – shows the value in the counter
increment-counter – increases value of counter
DO EXERCISE AT THIS POINT
Exercise 1 overview
One host (your own machine)
One web service running on own machine
One counter resource, which will already exist
Client running on own machine
Counter service
C
Client
One counter resource
Container
Exercise 1 overview
Counter service
ant startContainer
Starts up container,
with counter service
and a single counter
resource.
C
One counter resource
Container
Exercise 1 overview
show-counter and
increment-counter
clients interact with the
resource through the web
service.
Counter service
C
Client
One counter resource
Container
Module 2 – Resource Addressing
Endpoint References
TODO: counter service should initialise
with two counter resources by default (or
part of exercise is to modify code to do
this? This is probably better)
Why?
Need some way to refer to web services
and WS-Resources from anywhere on the
network.
Endpoint References
WS-Addressing specification
An Endpoint Reference (EPR) points to a
web service by including a URL.
Endpoint References
WS-Addressing specification
An Endpoint Reference (EPR) points to a
web service by including a URL.
TODO: paste in example EPR here
Endpoint References
WS-Addressing specification
An Endpoint Reference (EPR) points to a
web service by including a URL.
EPRs can also contain extra information
For WSRF, include ReferenceProperties that
identify a resource
Endpoint References
WS-Addressing specification
An Endpoint Reference (EPR) points to a
web service by including a URL.
EPRs can also contain extra information
For WSRF, include ReferenceProperties that
identify a resource
TODO: paste EPR with RefProps
A WSRF conformant EPR contains:
URL of web service
Key to resource for that service
Possibly other information
Security
Renewable References
Exercise 2
Exercise 2a: talk to second counter on own
machine
Exercise 2b: talk to someone else’s service on a
different laptop
Using local-b.epr
Using other.epr
Use same clients as before, but specifying an EPR
file
Should be able to run all of the clients against any
machine.
Exercise 2 scenario
Two hosts (your own machine and your friend’s machine)
One web service running on friend’s machine
One counter resource on friend’s machine
Client running on your own machine
Exercise 2 scenario
Client can talk to everyone’s servers – so the situation in
this room looks more like this.
Module 3 – Resource Properties
Resources have Resource Properties
Use of XML
Resource Properties element in WSDL
Querying Resource Properties
Why?
Resources represent state
Often we want to inspect that state
In this tutorial, we want to know the value
stored in each counter
(the show-counter client)
XML based
Each resource has a Resource Properties
document.
Defined in XML schema
Each element in the Resource Properties
document is a Resource Property (RP).
Ways to access RPs
Pull
Client can query the RP document
GetResourceProperty
GetMultipleResourceProperties
QueryResourceProperties
Push
Allows services to send changes in their
resources’ RPs to interested parties.
WS-Notification
Not covered in this tutorial
Pull operations
GetResourceProperty
GetMultipleResourceProperty
Requests a single resource property by
name
Requests several resource properties (from
the same resource) by name
QueryResourceProperties
More advanced queries against RP
document.
eg. XPath
Exercise 3
Exercise: add a resource property to the
service to give ‘last incremented time’.
Modify ‘show-counter’ to query this RP.
Query own counters and query other
peoples’ counters.
If time, can add another RP of own choice.
settable message
some other statistic such as ‘number of
times queried’
counter creation time
Module 4 – Resource Lifetime
Creating new resources
Destroying old resources
Soft-state lifetime management
Why?
Resources come and go
For example:
jobs in a batch submission system could be
represented as resources
submitting a new job causes a new resource
to be created
when the job is completed, the resource
goes away
Creating new resources
Factory pattern
A web service operation causes a new
resource to come into existence.
For example, in job submission:
submit(JobDescription)
Destroying resources
Two ways:
Immediate Destruction
Scheduled Destruction
Immediate destruction
Destroy the resource now!
Destroy operation
Scheduled Destruction
Scheduled destruction allows soft
management of state.
TerminationTime RP
Keep state alive for as long as we need it,
by calling SetTerminationTime operation
periodically.
Scheduled Destruction
Remote service is ‘self-cleaning’
old unwanted state gets cleaned up
automatically if no-one keeps it alive
Problem: if interested party is
disconnected from network for a long time,
then it cannot extend lifetime and state
may be cleaned up prematurely.
Soft-state
time
TODO
Exercise 4
Exercise: create new counters. Destroy old
counters.
Two new clients:
make-counter
destroy-counter
Exercise 4 scenario
Created new counters
Destroyed existing counters
A Brief Overview of the rest of WS-RF
WS-Resource Properties *
WS-Resource Lifetime *
WS-Servicegroups
WS-BaseFaults
WS-Renewable References
WS-Notification
* already covered
WS-ServiceGroups
TODO
WS-BaseFaults
TODO
WS-Renewable References
TODO
WS-Notification
A group of 3 standards
Can deliver notifications of events
For example, change in value of a resource
property
fin