Title: Web Services tying it all together and Introduction to Grid Services Concepts
1Web Services(tying it all together)and
Introduction to Grid Services Concepts
- These slides are adapted from course material
developed by Barry Wilkinson, http//sol.cs.wcu.ed
u/abw/CS493F04/
2Web Services
- Software components designed to provide specific
operations (services) accessible using standard
Internet technology. - Similar to RMI, CORBA,
- Client/server
- Platform independent
- Usually through SOAP (simple Object Access
Protocol) messages carrying XML documents, and a
HTTP transport protocol.
3Service-Oriented Architecture
- Steps
- Services published in a Service registry.
- Service requestor asks Service Registry to locate
service. - Service requestor binds with service provider
to invoke service.
4Service-Oriented Architecture
Service registry
1. Publish
2. Find
3. Bind
Service requester
Service provider
5Web Services Stack
XML
6Calling a Web Service
From http//www.globus.org
7Address of a Web Service
- Uses URIs (Uniform Resource Identifiers) - web
naming mechanism. - URLs are a subset of URI, and would typically be
used, e.g. - http//talon.csce.uark.edu/aapon/myMath
8- URIs also include email addresses, i.e.
- mailtoaapon_at_uark.edu
- and
- Uniform Resource Names (URNs) which are globally
unique and persistent. UDDI uses URNs.
9Hosting Environments for Web Services
- Microsoft .NET
- IBM Websphere
- Apache Axis - we are using this for the Web
Services exercise
10Client-Service Implementation
- Just as in Java RMI, client and server stubs are
used to handle the networking details. - Java classes suitable for web services defined
with WSDL. - Client stub marshalls the request,
- Server stub receives a SOAP request from the
client stub and converts it into a suitable form
for the service -unmarshalling. - Also converts the response from the service into
a SOAP message for the client stub.
11Steps
- 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.
12Web Service Application
SOAP request
Call client stub
Request service
SOAP response
Client receives result
Result returned
13Web Service Description
- Need a way of formally describing a service, what
is does, how it is accessed, etc. -
- An Interface Description language (IDL)
14Web 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.
15Parts 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
16Building a ServiceBackground for Web Services
exercise
- To build (deploy) a service one has to create
- a WSDL document for the service
- the client stub
- the server stub
- and test with a client.
17Java Web Service (JWS)(The easy way to deploy a
service)
- With JWS facility, service code with jws
extension in the Axis-enabled web application is
interpreted a web service. - .jws file automatically compiled if necessary
when service called. - Simple and used in Web Services exercise but has
limitations.
18- Could actually use the web service after
deployment with JWS without using a WSDL file nor
stubs! - Just use the service URL which would have a .jws
extension - need some code in client and service
to make SOAP calls.
19WSDL from Code
- One can write the service code (as a class or
interface) and then use tools to generate the
WSDL document. - Axis Java2WSDL program generates WSDL file (and
its scheme).
20WSDL from Running Service
- Another Axis tool can generate the WSDL
document.directly from a running deployed
service. - add ?wsdl onto service URL.
- Example of this in Web Services exercise
21Stubs from WSDL
- If we have the WSDL document for the service, can
use tools to generate client and server stubs - Axis WSDL2Java program generates stubs for use on
client and server - Example of this in Web Services exercise.
22Web Services Exercise
- This assignment uses
- Java 2 platform standard edition
- Apache Jakarta Tomcat Java servlet container
- Apache Axis tools
23Exercise Steps
- Write the Java code to implement the web service.
- Use Axis to generate all needed Java source
files. - Compile the source files just generated.
- Create client source and compile.
- Execute client to access service.
- Extend the functionality of the service.
24Axis Java Web Service Facility
- Place a jws (rather than java) file in your web
application directory structure and Axis will
automatically find it, compile it, and deploy the
methods.
25Step 1 Implement Service
- Using Java write the code for the class that
provides the web service. This code is - public class MyMath
- public int squared(int x)
- return x x
-
-
- Save that code as a .jws (Java Web Service)
file, Math.jws.
26Step 1 (continued)
- Copy the .jws file to the axis directory
- cp MyMath.jws \
- CATALINA_HOME/webapps/axis/yourusername
- Copying is needed so that the axis tools will be
able to find the .jws file
27Step 2 Generate WSDL files
- Use the Axis tools to create four Java source
files from MyMath.jws using the command - java -classpath AXISCLASSPATH \
- org.apache.axis.wsdl.WSDL2Java \
- http//localhost8080/axis/MyMath.jws?wsdl
-
-
28Step 2 (continued)
- Axis finds MyMath.jws file and creates
- Two source files each holding a Java interface,
- MyMath.java and
- MyMathService.java
- Two source files each holding a Java class,
- MyMathServiceLocator.java
- MyMathSoapBindingStub.java
- These files are put in a new package in
- localhost/axis/yourusername/MyMath_jws/
- which is in
- /home/yourusername/WebServices/
29Step 3 Compile new source files
- Compile source files generated by step 2 with
- javac -classpath AXISCLASSPATH \
- localhost/axis/yourusername/MyMath_jws/.java
-
30Step 4 Write Client Source
- import localhost.axis.yourusername.MyMath_jws.MyMa
thServiceLocator - import localhost.axis.yourusername.MyMath_jws.MyMa
thService - import localhost.axis.yourusername.MyMath_jws.MyMa
th - public class MyMathClient
- public static void main(String args) throws
Exception - MyMathService service new
MyMathServiceLocator() - MyMath myMath service.getMyMath()
- int x (new Integer(args0)).intValue()
- System.out.println("The square of " args0
" is " - myMath.squared(x))
-
-
31Step 5 Compile Client code
- Compile the client source file with
- javac -classpath AXISCLASSPATH.
MyMathClient.java -
32Step 6 Execute Web Service program
- java -classpath AXISCLASSPATH MyMathClient 4
- The square of 4 is 16
33Step 7 Extend the Web Service
- Add functionality to the MyMath web service
-
- Add a method that returns whether a number is
even. - Modify MyMath.jws file and repeat all previous
steps to test the extended web service.
34Extra Credit (not on assignment page)
- For extra credit, create a second web service and
demonstrate a client using two web services.
35Grid Services Concepts
36Grid 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.
37Grid Services
- Standard provides for interoperability of
independently developed services - Grid services based on extensions of Web Services
38- The Globus Grid Forum (GGF) standard currently
divided into - Open Grid Services Architecture (OGSA)
- and
- Open Grid Services Infrastructure (OGSI)
-
39Open Grid Services Architecture(OGSA)
40OGSA
- Defines standard mechanisms for creating, naming,
and discovering Grid service instances. - Addresses architectural issues relating to
interoperable Grid services. - Described in The Physiology of the Grid
- http//www.globus.org/research/papers/ogsa.pdf
41OGSI(Open Grid Services Infrastructure)
- Based upon Grid Service specification and
specifies way clients interact with a grid
service (service invocation management data
interface, security interface, ...). - Details
- http//www-unix.globus.org/toolkit/draft-ggf-ogsi-
gridservice-33_2003-06-27.pdf
42Based on http//www.globus.org
43This layer eliminated in most recent version of
standard under development
The core elements of the Open Grid Services
Architecture (shared)
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.
44Globus
- Open source grid software toolkit.
- Version 3 includes
- A complete implementation of OGSI
- Additional Web service components, some built on
top of OGSI. - We will use Globus 3.2 in Grid Services exercise.
45From http//www.globus.org
46- Grid services concept similar to Remote Procedure
Call (RPC), Remote Method Invocation (RMI), only
applied over HTTP - In fact, Java implementations will use RMI
underneath.
47Differences between a web service and a grid
service
- Grid services can be
- Stateful or Stateless
- Transient or Non-Transient.
- A web services is usually thought of as
non-transient and stateless.
48Instances of Grid services
- Clients interact with instances of grid services.
- Apart from being the usual approach in an object
oriented system, it enables clients to have
access to different instances of a service and
provides extended functionality to a web service.
Allows for transient and private instances. - Grid Services uses a Factory Service to create
and manage service instances.
49Grid Services Factory
From http//www.globus.org
50Client - Service Interaction
- One-to-One -- a client has its own instance of
a service. Most likely, instance destroyed with
interaction finished. - One-to-many -- instance of a services
available to multiple clients. Information from
service available to multiple clients.
51Grid Service Implementation
- Can be accessed remotely
- Potentially stateful
- Implements one of more WSDL portTypes
- Grid Service Factories can be used to create
instances of services with many portTypes - Introspection of a service to return information
(list of portTypes it implements)
52Next time
- More details on Grid Services and GT3
- It is time to talk about projects.