Assignment 1 “Deploying a Simple Web Service” Mark Holliday Department of Mathematics and Computer Science Western Carolina University.

Slides:



Advertisements
Similar presentations
Cognos Web Services Business Intelligence. SOA SOA (Service Oriented Architecture) The SOA approach involves seven key principles: -- Coarse -grained.
Advertisements

Introducing JavaScript
A1.1 Assignment 1 “Deploying a Simple Web Service” ITCS 4010/5010 Grid Computing, UNC-Charlotte B. Wilkinson, 2005.
Mark Holliday and Barry Wilkinson, 2004A2.1 Assignment 2 “Simple” Grid Services Assignment.
Introduction to JavaScript
Barry Wilkinson and Mark Holliday, 2004A1.1 Assignments Preliminaries Several computers are configured at WCU for the assignments. Here, terra.cs.wcu.edu.
A1.1 Assignment 1 “Deploying a Simple Web Service”
A3.1 Assignment 3 Simple Job Submission Using GT 4 GRAM.
1 CSC 551: Web Programming Spring 2004 client-side programming with JavaScript  scripts vs. programs  JavaScript vs. JScript vs. VBScript  common tasks.
6/2/2015Page 1 SOA Development and Deployment B. Ramamurthy.
Assignment 2 Modifying, Compiling, and Deploying a Simple Service Presenter Information goes Here.
Object-Oriented Enterprise Application Development Tomcat 3.2 Configuration Last Updated: 03/30/2001.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 42 Web Services.
Remote Method Invocation Chin-Chih Chang. Java Remote Object Invocation In Java, the object is serialized before being passed as a parameter to an RMI.
3b.1 Web Services Part II Implementation details ITCS 4010 Grid Computing, 2005, UNC-Charlotte, B. Wilkinson, slides 3b version 0.1.
1 Introduction to Java and Applet Lecture 3 from Chapters 1 and 2 of the complete reference.
1 Web Services – Part II CS , Spring 2008/9.
Distributed Web Software  Presentation-based, e.g., dynamic web pages  Service-based – Web Services.
Distributed Web Software Presentation-based, e.g., dynamic web pages Service-based – Web Services.
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
1 Java Server Programming zLecture 1 focuses on: yIntroduction to web services y Web Services using Axis y The bigger Picture: Introduction to J2EE y Java.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
Advance Computer Programming Java Database Connectivity (JDBC) – In order to connect a Java application to a database, you need to use a JDBC driver. –
Web Services (tying it all together) and Introduction to Grid Services Concepts These slides are adapted from course material developed by Barry Wilkinson,
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
1 Lecture 22 George Koutsogiannakis Summer 2011 CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES.
1 3. Implementing Web Services 1.Create SOAP proxy interfaces and WSDL based service descriptions 2.Register/publish services 3.Stores service descriptions.
SSC2: Web Services. Web Services Web Services offer interoperability using the web Web Services provide information on the operations they can perform.
WSDL Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
Grid Computing, B. Wilkinson, 20043b.1 Web Services Part II.
Understanding the CORBA Model. What is CORBA?  The Common Object Request Broker Architecture (CORBA) allows distributed applications to interoperate.
Presentation: SOAP in a distributed object framework, Application Servers & AXIS SOAP.
COP 4991 Component Based Software Development Lecture #4 Java Web Services Onyeka Ezenwoye.
Chapter 17 - Deploying Java Applications on the Web1 Chapter 17 Deploying Java Applications on the Web.
Guidelines for Homework 6. Getting Started Homework 6 requires that you complete Homework 5. –All of HW5 must run on the GridFarm. –HW6 may run elsewhere.
Working With Apache Axis. Axis Information See guide.html for the basic user guide.
Presentation: Advanced AXIS: Deployment Descriptors and Advanced Types.
1 Creating File Access Services Presented by Ashraf Memon Hands-on Ashraf Memon, Ghulam Memon.
11 Web Services. 22 Objectives You will be able to Say what a web service is. Write and deploy a simple web service. Test a simple web service. Write.
Chapter 3 Servlet Basics. 1.Recall the Servlet Role 2.Basic Servlet Structure 3.A simple servlet that generates plain text 4.A servlet that generates.
Presentation: SOAP/WS in a distributed object framework, Application Servers & AXIS SOAP.
A Geographically-Distributed, Assignment-Structured Undergraduate Grid Computing Course Mark A. Holliday, Barry Wilkinson, Jeffrey House, Samir Daoud,
SOAP Web Services Tim Carver MRC HGMP-RC Hinxton Cambridge, UK.
Presentation: SOAP/WS in a distributed object framework, Application Servers & AXIS SOAP.
Course Schedule Report Web Service Carolyn Cracraft Lisa de Larios-Heiman.
1 Creating Web Services from a existing tool Presented by Ashraf Memon Hands-on Ashraf Memon, Ghulam Memon.
1 Creating Web Services Presented by Ashraf Memon Hands-on Ghulam Memon, Longjiang Ding.
ODS – Introduction to Web Services and BPEL Vakgroep Informatietechnologie Web Services & BPEL Design of Distributed Software.
WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic.
How to Write a Grid Service  The grid service will do basic mathematical operations. The math grid service is going to have the following methods:  add:
1 G52IWS: Example Web-services Chris Greenhalgh. 2 Contents Software requirements AXIS web service run-time components Getting started with Jetty & AXIS.
GT3 Tutorial Chapter 3 and Chapter 4 Lecture for Cluster and Grid Computing, CSCE 490/590 Fall 2004, University of Arkansas, Dr. Amy Apon
1 Creating Data Access Services Presented by Ashraf Memon Hands-on Ghulam Memon, Longjiang Ding.
Soaplab SOAP-based Analysis Web Services Martin Senger
Servers- Apache Tomcat Server Server-side scripts- Java Server Pages.
Creating Web Services Presented by Ashraf Memon Presented by Ashraf Memon.
1 G52IWS: Web Services Description Language (WSDL) Chris Greenhalgh
Net-centric Computing Web Services. Lecture Outline  What is Web Service  Web Service Architecture  Creating and using Java Web Services  Apache Axis.
Introduction to UML and Rational Rose UML - Unified Modeling Language Rational Rose 98 - a GUI tool to systematically develop software through the following.
Beginning 자바 웹 서비스 웹 서비스 호출 Meilan JIANG Cyber infrastructure Research Laboratory Department of Advanced Technology.
IST 210: PHP Basics IST 210: Organization of Data IST2101.
Soaplab - overview SOAP-based Analysis Web Services Martin Senger
Setting Up First, install tomcat and axis as described elsewhere. Then copy Tomcat into a second folder. –I’ve named mine jakarta- tomcat-server and jakarta-
Labs: Create, deploy and test a simple web service
Chapter 5 Remote Procedure Call
Writing simple Java Web Services using Eclipse
Outline SOAP and Web Services in relation to Distributed Objects
Outline SOAP and Web Services in relation to Distributed Objects
Objectives In this lesson you will learn about: Need for servlets
The for-statement.
Presentation transcript:

Assignment 1 “Deploying a Simple Web Service” Mark Holliday Department of Mathematics and Computer Science Western Carolina University

Acknowledgement This assignment is derived from: “Classroom Exercises for Grid Services” by A. Apon, J. Mache, Y. Yara, and K. Landrus, Proc. 5 th Int. Conference on Linux Clusters: The HPC Revolution, May 2004.

About The Assignment The main task of this assignment is to build, deploy and test a simple web service. The tools involved for this assignment includes: –Java Development Kit –Apache Jakarta Tomcat Java servlet container –Apache Axis tools

We will: 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.

This Process in A Diagram

There are two ways to attain our Web Service The Standard Approach – Using two different Apache Axis tools to generate the required documents. The Shortest Path – Use one command to trigger both Apache Axis tools. –We will only use the Standard Approach.

Demonstration: Creating our directory structure. As part of the account creation process, the system administrator created a directory in $CATALINA_HOME/webapps/axis that represents your username. Check out this directory yourself: % cd \ $CATALINA_HOME/webapps/axis /yourusername

Step 1 – Generating the source code for the Service Java is used to provide the service. The following code defines our service: public class MyMath { public int squared( int x ){ return x * x; } } This code is located in ‘ /home/yourusername/MyMath.jws ’

Demonstration: Deploy The Math Service 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. (Also the service will be locatable from a web browser.)

Demonstration: View Your Service Load up any web browser. (Internet Explorer, Mozilla, Firefox, Netscape) Point your web browser to Click on the “ MyMath.jws ” link. –Axis will tell you that there is a service there! Click on the WSDL link to view the WSDL code.

What is WSDL? WSDL stands for Web Service Definition Language. WSDL is an XML document that defines what operations a Web Service offers. Each Java method that the service offers has an entry in the WSDL.

We have our service out there, now what? Yes, the service is deployed. However, we have no client access to the server. We must now create a set of interfaces that can access the server. Axis provides tools to create the WSDL that can then be used to create interfaces to the service.

Demonstration: Acquire the WSDL In order to create a client that can access the Web Service, we must have access to the WSDL. Apache Axis provides a command line tool to create the WSDL file.

Demonstration (Con’t) Get a port type prepared: % cp MyMath.jws MyMath.java Type in the following command to generate the WSDL file: % java org.apache.axis.wsdl.Java2WSDL –o \ MyMath.wsdl \ -l" \ MyMath

What does the Java2WSDL arguments do? The ‘ org.apache.axis.wsdl.Java2WSDL ’ argument gives the package information on where to find the Java2WSDL class. The ‘ -o MyMath.wsdl ’ argument gives the filename of the output WSDL file. The ‘ -l” axis/yourusername/MyMath ”' argument gives the location of the service in question.

What does Java2WSDL do? Java2WSDL takes a Java class (or interface) and generates the WSDL document that describes the service. Requires either the original service’s source code as a *.java file, or an interface that displays each method.

Demonstration: Creating stubs for the new service Stub creation is done using the Axis tool ‘ WSDL2Java ’. WSDL2Java is not the reverse of Java2WSDL. (That is, one does not undo the other.) We use the WSDL document that we created in the last step to create the stubs.

Demonstration (Con’t): Creation of Stubs The WSDL2Java will create the interfaces: %java org.apache.axis.wsdl.WSDL2Java \ –o. –d Session –s –S true –p \ localhost.axis.yourusername.MyMath_jws \ MyMath.wsdl

Demonstration (Con’t): Creation of Stubs – What the command means The ‘ org.apache.axis.wsdl.WSDL2Java ’ argument defines which package the WSDL2Java class resides in. The ‘ -o ’ argument specifies that the output files should be placed in the current directory. The ‘ -s -S true ’ argument specifies that the server side bindings and the skeleton should be deployed. The ‘ -p localhost.axis.yourusername. MyMath_jws ’ argument specifies the package the classes and stubs should be placed in. This command outputs several files which will be described later in this section.

The Created Data Structure The result of this command is the following files: –MyMathService.java – the source for the Java interface that includes the getMyMath() method specification. –MyMathServiceLocator.java – the source for the Java class MyMathServiceLocator. –MyMathSoapBindingStub – the source for the Java class MyMathSoapBindingStub, which provides bindings to the MathService.

Demonstration: Compilation Process Compile the new Java classes using the following command: %javac -cp $AXISCLASSPATH:$CLASSPATH \ domain/server/username/MyMath_jws/*.java

Creation of the Client The client for the service uses the previously compiled Java classes. The client to the service is provided in /home/username/MyMathClient.java

Explanation of Client For the time being, just assume that the import statements are invisible. MyMathService service = new MyMathServiceLocator(); Options options = new Options( args ); String endpoint = " + options.getPort() + "/axis/yourusername/MyMath.jws"; Call call = (Call) service.createCall(); call.setTargetEndpointAddress( new URL( endpoint ) ); call.setOperationName( "squared" );

call.addParameter( "op1", XMLType.XSD_INT, ParameterMode.IN); call.addParameter( "op2", XMLType.XSD_INT, ParameterMode.OUT ); call.setReturnType( XMLType.XSD_INT ); ret = (Integer) call.invoke( new Object[] { x } ); Each of these commands add a different argument to the interface that the method ‘ squared ’ uses.

Demonstration: Compiling the Java Client The client code is located in “ /home/yourusername/ assignment1/MyMathClient.java ” Compilation occurs in one step: % javac -classpath \ $AXISCLASSPATH:$CLASSPATH:. \ MyMathClient.java

Demonstration: Running the Client Running the client is also done from the command line: % java -classpath \ $AXISCLASSPATH:$CLASSPATH:.\ MyMathClient –p This call will use port 8080 to find the service, and will square the number 4.

What’s Next? At this point, we would extend the functionality of the MyMath service by adding two new methods: –boolean isPrime( int number ) – Determines whether a number is prime or not. –boolean isEven( int number ) – Determines whether a number is even.

Conclusion We have: –Written the Java code to implement a math web service. –Used Axis to generate all needed Java source files. –Compiled the source files that we generated. –Created the client source code. –Compiled the client source code. –Executed the client to access the service.

Questions? Please Ask!