Download presentation
Presentation is loading. Please wait.
Published byYadira Peck Modified over 9 years ago
1
Barry Wilkinson and Mark Holliday, 2004A1.1 Assignments Preliminaries Several computers are configured at WCU for the assignments. Here, terra.cs.wcu.edu will be used. For technical reasons, students using the WCU computers will first ssh into sol.cs.wcu.edu, and from there ssh into terra.cs.wcu.edu.
2
Barry Wilkinson and Mark Holliday, 2004A1.2 Assignment 1 “Deploying a Simple Web Service” Acknowledgement This assignment is derived from: “Classroom Exercises for Grid Services” by A. Apon, J. Mache, Y. Yara, and K. Landrus, Proc. 5th Int. Conference on Linux Clusters: The HPC Revolution, May 2004.
3
Barry Wilkinson and Mark Holliday, 2004A1.3 Task To build, deploy and test a simple web service.
4
Barry Wilkinson and Mark Holliday, 2004A1.4 Tools This assignment uses: –Java 2 platform standard edition –Apache Jakarta Tomcat Java servlet container –Apache Axis tools
5
Barry Wilkinson and Mark Holliday, 2004A1.5 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.
6
Barry Wilkinson and Mark Holliday, 2004A1.6 Client Web service Apache hosting environment
7
Barry Wilkinson and Mark Holliday, 2004A1.7 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.
8
Barry Wilkinson and Mark Holliday, 2004A1.8 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.
9
Barry Wilkinson and Mark Holliday, 2004A1.9 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
10
Barry Wilkinson and Mark Holliday, 2004A1.10 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
11
Barry Wilkinson and Mark Holliday, 2004A1.11 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/
12
Barry Wilkinson and Mark Holliday, 2004A1.12 Step 3 Compile new source files Compile source files generated by step 2 with: javac -classpath $AXISCLASSPATH \ localhost/axis/yourusername/MyMath_jws/*.java
13
Barry Wilkinson and Mark Holliday, 2004A1.13 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)); }
14
Barry Wilkinson and Mark Holliday, 2004A1.14 Step 5 Compile Client code Compile the client source file with: javac -classpath $AXISCLASSPATH:. MyMathClient.java
15
Barry Wilkinson and Mark Holliday, 2004A1.15 Step 6 Execute Web Service program java -classpath $AXISCLASSPATH MyMathClient 4 The square of 4 is 16
16
Barry Wilkinson and Mark Holliday, 2004A1.16 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.
17
Barry Wilkinson and Mark Holliday, 2004A1.17 Step 8 (not in handout) Extra Credit For extra credit, create a second web service and demonstrate a client using two web services.
18
Barry Wilkinson and Mark Holliday, 2004A1.18 Submission of Assignment 1 Produce a 2-4 page Word document. Includes how you modified the service (code and explanation). Show that you successfully followed the instructions and performs all tasks by taking screen shots and include these screen shots in the document. Number of screen shots is up to you but it should demonstrate your programs worked. –To include screen shots from Windows XP, select window, press Alt-Printscreen, and paste to file.
19
Barry Wilkinson and Mark Holliday, 2004A1.19 Submission continued Submit your document to me electronically using the WCU Department of Mathematics and Computer Science electronic submission system called Hermes. PLEASE DO NOT SUBMIT BY EMAIL TO ME!!
20
Barry Wilkinson and Mark Holliday, 2004A1.20 Hermes Submission System Go to: http://www.cs.wcu.edu/~hermes Select professor (Barry Wilkinson), then Select course (CS493 Fall 2004 Grid computing), then Select your name, then Select your document and select upload. A message is displayed as a receipt. Also email sent to you.
21
Barry Wilkinson and Mark Holliday, 2004A1.21 Due Date 11:59 pm Thursday September 9th, 2004 unless we have system problems.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.