Web Services CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.

Slides:



Advertisements
Similar presentations
JSP and web applications
Advertisements

WEB SERVICES. FIRST AND FOREMOST - LINKS Tomcat AXIS2 -
Web Services Web Services are the basic fundamental building blocks of invoking features that can be accessed by an application program. The accessibility.
A1.1 Assignment 1 “Deploying a Simple Web Service”
6/11/2015Page 1 Web Services-based Distributed System B. Ramamurthy.
Web Services Jeffrey Miller California State University Los Angeles Winter 2003.
J2ME RMI 1 Java 2 Platform, Micro Edition Implementation of J2ME RMI Application Farooq Sheikh.
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.
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.
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.
Java Servlets and JSP.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
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.
SSC2: Web Services. Web Services Web Services offer interoperability using the web Web Services provide information on the operations they can perform.
Web Services Overview Ashraf Memon. 2 Overview Service Oriented Architecture Web service overview Benefits of Web services Core technologies: XML, SOAP,
Presentation: SOAP in a distributed object framework, Application Servers & AXIS SOAP.
COP 4991 Component Based Software Development Lecture #4 Java Web Services Onyeka Ezenwoye.
Functionality of a web server What does the web server do? Let a user request a resource Find the resource Return something to the user The resource can.
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.
|Tecnologie Web L-A Anno Accademico Laboratorio di Tecnologie Web Introduzione ad Eclipse e Tomcat
1 HKU CSIS DB Seminar: HKU CSIS DB Seminar: Web Services Oriented Data Processing and Integration Speaker: Eric Lo.
CSCI 6962: Server-side Design and Programming Web Services.
Lecture 15 Introduction to Web Services Web Service Applications.
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.
Java Environment CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
Current Trends in Network- Based Application Developments Bill Chu Department of Software and Information Systems UNC Charlotte.
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.
Java Servlets Lec 27. Creating a Simple Web Application in Tomcat.
SOAP Web Services Tim Carver MRC HGMP-RC Hinxton Cambridge, UK.
Presentation: SOAP/WS in a distributed object framework, Application Servers & AXIS SOAP.
CORBA – Command Line CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 23 — Simple Object Access Protocol (SOAP) and Microsoft BizTalk™ Outline 23.1Introduction 23.2Simple.
Distributed Programming CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
RMI – Command Line CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
Topic Java EE installation (Eclipse, glassfish, etc.) Eclipse configuration for EE Creating a Java Web Dynamic Project Creating your first servlet.
RMI - Eclipse CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
JDBC Tutorial CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
1 Creating Web Services from a existing tool Presented by Ashraf Memon Hands-on Ashraf Memon, Ghulam Memon.
CORBA – Eclipse CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
CS603 Communication Mechanisms: SOAP 25 January 2002.
1 Grid Web Services and Gateway PTLIU Laboratory for Community Grids Marlon Pierce, Choonhan Youn, Geoffrey Fox, Computer Science, Informatics, Physics.
1 Creating Web Services Presented by Ashraf Memon Hands-on Ghulam Memon, Longjiang Ding.
ASP.NET Web Services.  A unit of managed code installed under IIS that can be remotely invoked using HTTP.
Concurrent Computing CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
Serialization CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
SOAP 2. SOAP Example POST /StockQuote HTTP/1.1 Host: Content-Type: text/xml; charset="utf-8"Content-Length: nnnn SOAPAction:"Some-URI"
1 G52IWS: Example Web-services Chris Greenhalgh. 2 Contents Software requirements AXIS web service run-time components Getting started with Jetty & AXIS.
Intro to Web Services Dr. John P. Abraham UTPA. What are Web Services? Applications execute across multiple computers on a network.  The machine on which.
Modern Programming Language. Web Container & Web Applications Web applications are server side applications The most essential requirement.
Semaphores CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
Creating Web Services Presented by Ashraf Memon Presented by Ashraf Memon.
3/5/2002e-business and Information Systems1 Java Java Java Virtual Machine (JVM) Java Application Program Interface (API) HW Kernel API Application Programs.
UMBC Distributed Computing with Objects RMI/Corba CMSC 432 Shon Vick.
Networking Code CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
Net-centric Computing Web Services. Lecture Outline  What is Web Service  Web Service Architecture  Creating and using Java Web Services  Apache Axis.
The Java API for XML-Based Web Services. A Web Service example in Java SOAP-awareServlet (e.g. Apache Axis2) SOAP-awareServlet Any class processing the.
Java Web Services Orca Knowledge Center – Web Service key concepts.
Principles of Software Development
Web Services-JAX-RPC JAX-RPC enables a Web Service endpoint to be developed using either a Java Servlet or Enterprise JavaBeans (EJB) component model.
Outline SOAP and Web Services in relation to Distributed Objects
Course Outcomes of Advanced Java Programming AJP (17625, C603)
Outline SOAP and Web Services in relation to Distributed Objects
Java Servlets and JSP.
Distributed System using Web Services
Presentation transcript:

Web Services CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L

Outline USC CSCI 201L2/14 ▪Web Services ▪Program

Web Services Overview ▪Web services are client and server applications that communicate over HTTP to implement RPCs ›They are language- and platform-independent ›Data is transmitted in a standardized XML format ▪Big Web Services ›Java API for XML Web Services (JAX-WS) ›Use XML messages following Simple Object Access Protocol (SOAP) ›Operations offered by the service are include in the Web Services Description Language (WSDL) ▪RESTful Web Services ›Java API for RESTful Web Services (JAX-RS) ›No requirement of XML messages or WSDL service ▪Additional information can be found at intro.htm USC CSCI 201L3/14 Web Services

Web Services Pre-Configuration ▪Install a Java Application Server, such as Tomcat or Glassfish (comes with Java EE SDK) (Download the core) ▪Download the following soap-bin-2.2.zip - ›Xerces2_Java_ zip - ›javax.mail.jar - version ›activation.jar from JavaBeans Activation Framework - archive-downloads-java-plat html#jaf fcs-oth-JPR ▪The necessary files are posted on the course web site ›Copy soap.jar, xml-apis.jar, javax.mail.jar, and activation.jar from the above files into the lib directory of your application server ›Copy soap.war from the soap-bin-2.2.zip file into the webapps directory of your application server ▪Start your application server so the web archive (WAR) file will be loaded ›From the bin directory of Tomcat, run startup.exe or startup.sh USC CSCI 201L4/14 Web Services

Application Server Installation ▪If the application server was installed and started properly, when you go to in a browser, you will see the following USC CSCI 201L5/14 Web Services

JAX-WS Application Example ▪Here are the steps for setting up a web service with JAX-WS 1. Write the web service server code 2. Compile the web service server 3. Create a document descriptor file for the web service 4. Deploy the web service server in an application server 5. Write the web service client code 6. Compile the web service client 7. Run the web service client USC CSCI 201L6/14 Web Services

JAX-WS Application Example – Step 1 ▪Step 1 – Write the web service server code ›The web service server is just a class that has one or more methods in it ›Standard types must be used that SOAP supports If SOAP doesn’t support the type, you can create custom types in SOAP, though you are binding your application to languages that support the custom type then ›Your code can be in a package USC CSCI 201L7/14 Web Services

JAX-WS Application Example – Step 2 ▪Step 2 – Compile the web service server ›Compile the Java code just like any other class, from the directory that contains the top-most package Windows - javac csci201\SortServer.java Mac – javac csci201/SortServer.java ›Copy the compiled class into the following directory in your application server webapps\soap\WEB-INF\classes\ \ ›Restart the application server SortServer.java 1 package csci201; 2 3 public class SortServer { 4 public int[] sort(int [] numbers) { 5 int temp; 6 for (int i=0; i < numbers.length; i++) { 7 for (int j=0; j < i; j++) { 8 if (numbers[i] > numbers[j]) { 9 temp = numbers[i]; 10 numbers[i] = numbers[j]; 11 numbers[j] = temp; 12 } 13 } 14 } 15 return numbers; 16 } 17 } USC CSCI 201L8/14 Web Services

JAX-WS Application Example – Step 3 ▪Step 3 – Create a document descriptor file for the web service ›The document descriptor file lets the application server know that a class is a web service, as well as what methods in the class are exposed ›Java annotations can also be used instead of a.dd file ›You can also deploy through an administrator interface included in soap.war – sort.dd org.apache.soap.server.DOMFaultListener USC CSCI 201L9/14 Web Services

JAX-WS Application Example – Step 4 ▪Step 4 – Deploy the web service server in an application server ›This will allow clients to connect to the application server and request the web service, similar to connecting to the rmiregistry in RMI or the ORB in CORBA Windows - java –classpath soap.jar;javax.mail.jar org.apache.soap.server.ServiceManagerClient deploy sort.dd Mac - java –classpath soap.jar:javax.mail.jar org.apache.soap.server.ServiceManagerClient deploy sort.dd ›To ensure the web service is deployed correctly, you can: List the deployed web services on the command line java –classpath soap.jar;javax.mail.jar org.apache.soap.server.ServiceManagerClient list View them in a browser Open –Note: You can also deploy without a document descriptor through the admin interface USC CSCI 201L10/14 Web Services

JAX-WS Application Example – Step 5 ▪Step 5 – Write the web service client code ›The client has the code for communicating with the web service and then making what appears to be a local call to a method SortClient.java 1 import java.io.*; 2 import java.net.*; 3 import java.util.*; 4 import org.apache.soap.*; 5 import org.apache.soap.rpc.*; 6 7 public class SortClient { 8 public static void main(String [] args) { 9 try { 10 URL url = new URL(" 11 Call call = new Call(); 12 call.setTargetObjectURI("urn:sort1"); 13 call.setMethodName("sort"); 14 call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC); 15 Vector params = new Vector(); 16 int [] array1 = {21, 65, 87, 78, 45}; 17 params.addElement(new Parameter("numbers", int[].class, array1, null)); 18 call.setParams(params); 19 Response resp = call.invoke(url, ""); 20 if (resp.generatedFault()) { 21 Fault fault = resp.getFault(); 22 System.out.println("fault: " + fault); 23 } 24 else { 25 Parameter result = resp.getReturnValue(); 26 int [] sortedArray = (int[])result.getValue(); 27 for (int i=0; i < sortedArray.length; i++) { 28 System.out.println(sortedArray[i]); 29 } 30 } 31 } catch (IOException ioe) { 32 System.out.println("IOException: " + ioe.getMessage()); 33 } catch (SOAPException se) { 34 System.out.println("SOAPException: " + se.getMessage()); 35 } 36 } 37 } USC CSCI 201L11/14 Web Services

JAX-WS Application Example – Steps 6, 7 ▪Step 6 – Compile the web service client Windows - javac –classpath.;soap.jar SortClient.java Mac - javac –classpath.:soap.jar SortClient.java ▪Step 7 – Run the web service client Windows - java –classpath.;soap.jar;javax.mail.jar SortClient Mac - java –classpath.:soap.jar:javax.mail.jar SortClient ›Since Tomcat is already running with the deployed web service, the client just needs to be executed USC CSCI 201L12/14 Web Services

Outline USC CSCI 201L13/14 ▪W▪Web Services ▪P▪Program

Program ▪Create a web service server to communicate over CORBA to the CORBA server object that communicates over RMI to find the value of Pi to a certain number of digits ▪Utilize the CORBA to RMI code from the previous lecture USC CSCI 201L14/14 Program