Download presentation
Presentation is loading. Please wait.
Published byLetitia Stafford Modified over 9 years ago
1
Web 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.edu/~abw/CS493F04/ http://sol.cs.wcu.edu/~abw/CS493F04/
2
Web 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.
3
Service-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.
4
2. Find 3. Bind 1. Publish Service-Oriented Architecture Service requester Service registry Service provider
5
Web Services “Stack” + XML
6
Calling a Web Service From http://www.globus.org
7
Address of a Web Service Uses URI’s (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. mailto:aapon@uark.edu and Uniform Resource Names (URNs) which are globally unique and persistent. UDDI uses URNs.
9
Hosting Environments for Web Services Microsoft.NET IBM Websphere Apache Axis - we are using this for the Web Services exercise
10
Client-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.
11
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.
12
Web Service Application Call client stub SOAP request Request service Result returned SOAP response Client receives result
13
Web Service Description Need a way of formally describing a service, what is does, how it is accessed, etc. An Interface Description language (IDL)
14
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.
15
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
16
Building a Service Background 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.
17
Java 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.
19
WSDL 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).
20
WSDL 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
21
Stubs 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.
22
Web Services Exercise This assignment uses: –Java 2 platform standard edition –Apache Jakarta Tomcat Java servlet container –Apache Axis tools
23
Exercise 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.
24
Axis 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.
25
Step 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.
26
Step 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
27
Step 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://localhost:8080/axis/MyMath.jws?wsdl
28
Step 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/
29
Step 3 Compile new source files Compile source files generated by step 2 with: javac -classpath $AXISCLASSPATH \ localhost/axis/yourusername/MyMath_jws/*.java
30
Step 4: Write Client Source import localhost.axis.yourusername.MyMath_jws.MyMathServiceLocator; import localhost.axis.yourusername.MyMath_jws.MyMathService; import localhost.axis.yourusername.MyMath_jws.MyMath; public class MyMathClient { public static void main(String args[]) throws Exception { MyMathService service = new MyMathServiceLocator(); MyMath myMath = service.getMyMath(); int x = (new Integer(args[0])).intValue(); System.out.println("The square of " + args[0] + " is " + myMath.squared(x)); }
31
Step 5 Compile Client code Compile the client source file with: javac -classpath $AXISCLASSPATH:. MyMathClient.java
32
Step 6 Execute Web Service program java -classpath $AXISCLASSPATH MyMathClient 4 The square of 4 is 16
33
Step 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.
34
Extra Credit (not on assignment page) For extra credit, create a second web service and demonstrate a client using two web services.
35
Grid Services Concepts
36
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.
37
Grid 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)
39
Open Grid Services Architecture (OGSA)
40
OGSA 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
41
OGSI (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
42
Based on http://www.globus.org
43
The core elements of the Open Grid Services Architecture (shared) This layer eliminated in most recent version of standard under development 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.
44
Globus 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.
45
From 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.
47
Differences 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.
48
Instances 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.
49
Grid Services Factory From http://www.globus.org
50
Client - 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.
51
Grid 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)
52
Next time More details on Grid Services and GT3 It is time to talk about projects.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.