WEB SERVICES 1 From Chapter 19 of Distributed Systems Concepts and Design,4 th Edition, By G. Coulouris, J. Dollimore and T. Kindberg Published by Addison.

Slides:



Advertisements
Similar presentations
18 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Introduction to Web Services.
Advertisements

31242/32549 Advanced Internet Programming Advanced Java Programming
Web Service Ahmed Gamal Ahmed Nile University Bioinformatics Group
Slides for Chapter 20: CORBA Case Study From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 4, © Addison-Wesley 2005.
General introduction to Web services and an implementation example
SOAP.
Topics Acronyms in Action SOAP 6 November 2008 CIS 340.
Web Services Darshan R. Kapadia Gregor von Laszewski 1http://grid.rit.edu.
Web Services Nasrullah. Motivation about web service There are number of programms over the internet that need to communicate with other programms over.
TCP/IP Protocol Suite 1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 22 World Wide Web and HTTP.
SOAP Quang Vinh Pham Simon De Baets Université Libre de Bruxelles1.
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.
Copyright © George Coulouris, Jean Dollimore, Tim Kindberg This material is made available for private study and for direct.
Lecture 10: Web Services. Outline Overview of Web Services Create a Web Service with Sun J2EE (JAX-RPC)
OCT 1 Master of Information System Management Organizational Communications and Distributed Object Technologies Lecture 11: CORBA.
Java RMI, JAX-RPC and JWSDP
Systems Architecture, Fourth Edition1 Internet and Distributed Application Services Chapter 13.
.NET Mobile Application Development Remote Procedure Call.
CORBA Chapter 17 Coulouris text. Today’s Topics CORBA History and goals CORBA RMI CORBA services The Distributed Whiteboard Revisited.
Slides for Chapter 5: Communication between distributed objects
Source: George Colouris, Jean Dollimore, Tim Kinderberg & Gordon Blair (2012). Distributed Systems: Concepts & Design (5 th Ed.). Essex: Addison-Wesley.
Processing of structured documents Spring 2003, Part 6 Helena Ahonen-Myka.
From Coulouris, Dollimore, Kindberg and Blair Distributed Systems: Concepts and Design Edition 5, © Addison-Wesley 2012 Slides for Chapter 9 Web Services.
Chapter 19 Web Services. Web services infrastructure and components Security Service descriptions (in WSDL) Applications Directory service Web Services.
INTRODUCTION TO WEB DATABASE PROGRAMMING
1 3. Implementing Web Services 1.Create SOAP proxy interfaces and WSDL based service descriptions 2.Register/publish services 3.Stores service descriptions.
JavaScript, Fourth Edition Chapter 12 Updating Web Pages with AJAX.
SOAP Tutorial Ching-Long Yeh 葉慶隆 Department of Computer Science and Engineering Tatung University
From Coulouris, Dollimore, Kindberg and Blair Distributed Systems: Concepts and Design Edition 5, © Addison-Wesley 2012 Slides for Chapter 8: Distributed.
Exercises for Chapter 2: System models
Lecture 15 Introduction to Web Services Web Service Applications.
Dodick Zulaimi Sudirman Lecture 14 Introduction to Web Service Pengantar Teknologi Internet Introduction to Internet Technology.
Web Services based e-Commerce System Sandy Liu Jodrey School of Computer Science Acadia University July, 2002.
From Coulouris, Dollimore, Kindberg and Blair Distributed Systems: Concepts and Design Edition 5, © Addison-Wesley 2012 Exercises for Chapter 9: Web Services.
Systems Prog. & Script. - Heriot Watt Univ 1 Systems Programming & Scripting Lecture 11: The Distributed Object Model.
Lecture 5: RPC and Distributed Objects Haibin Zhu, PhD. Assistant Professor Department of Computer Science Nipissing University © 2002.
Chapter 10 Intro to SOAP and WSDL. Objectives By study in the chapter, you will be able to: Describe what is SOAP Exam the rules for creating a SOAP document.
Slides for Chapter 17: CORBA Case Study From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 3, © Addison-Wesley 2001.
Copyright © 2013 Curt Hill SOAP Protocol for exchanging data and Enabling Web Services.
1 Web Services Web and Database Management System.
XML and Web Services (II/2546)
Chapter 5: Distributed objects and remote invocation Introduction Remote procedure call Events and notifications.
2007cs Servers on the Web. The World-Wide Web 2007 cs CSS JS HTML Server Browser JS CSS HTML Transfer of resources using HTTP.
Kemal Baykal Rasim Ismayilov
27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Web Services An Introduction Copyright © Curt Hill.
Slides for Chapter 5: Distributed objects and remote invocation From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition.
EGEE is a project funded by the European Union under contract IST Introduction to Web Services 3 – 4 June
27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
SOAP, Web Service, WSDL Week 14 Web site:
Distributed Computing & Embedded Systems Chapter 4: Remote Method Invocation Dr. Umair Ali Khan.
From Coulouris, Dollimore, Kindberg and Blair Distributed Systems: Concepts and Design Edition 5, © Addison-Wesley 2012 Slides for Chapter 9 Web Services.
Distributed Web Systems Distributed Objects and Remote Method Invocation Lecturer Department University.
Sabri Kızanlık Ural Emekçi
WEB SERVICES From Chapter 19 of Distributed Systems Concepts and Design,4th Edition, By G. Coulouris, J. Dollimore and T. Kindberg Published by Addison.
Chapter 5 Remote Procedure Call
Slides for Chapter 19 Web Services
Edition 5, © Addison-Wesley 2012
Distributed Systems Course Topics in distributed objects
Programming Models for Distributed Application
Slides for Chapter 19 Web Services
Slides for Chapter 5: Distributed objects and remote invocation
Remote method invocation (RMI)
Distributed Systems through Web Services
Creating a Distributed System with Remote Procedure Calls and Web Services Ch.5 B.Ramamurthy 2/17/2019 B.Ramamurthy.
Distributed System using Web Services
WEB SERVICES From Chapter 19, Distributed Systems
Distributed System using Web Services
Presentation transcript:

WEB SERVICES 1 From Chapter 19 of Distributed Systems Concepts and Design,4 th Edition, By G. Coulouris, J. Dollimore and T. Kindberg Published by Addison Wesley/Pearson Education June 2005

WEB SERVICES 2 Topics Introduction Web Services SOAP (Simple Object Access Protocol) Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 3 Introduction  A web service provides a service interface enabling clients to interact with servers in a more general way than web browsers do.  Clients access the operations in the interface of a web service by means of requests and replies formatted in XML and usually transmitted over HTTP. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 4 Introduction  Users require a secure means for creating, storing and modifying documents and exchanging them over the Internet.  The secure channels of TLS do not provide all of the necessary requirements.  XML security is intended to breach this gap. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 5 Introduction  Web services provide an infrastructure for maintaining a richer and more structured form of interoperability between clients and servers.  They provide a basis whereby a client program in one organization may interact with a server in another organization without human supervision. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 6 Introduction  External data representation and marshalling of messages exchanged between clients and web services is done in XML. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 7 Introduction  The SOAP (Simple Object Access Protocol) specifies the rules for using XML to package messages, for example to support a request-reply protocol.  Figure 1 summarizes the main points about the communication architecture in which web services operate. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 8 Introduction Figure 1. Web services infrastructure and components Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 9 Introduction  A web service is identified by a URL and can be accessed by clients using messages formatted in XML. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 10 Introduction  SOAP is used to encapsulate these messages and transmit them over HTTP or another protocol, for example, TCP or SMTP.  A web service generally provides a service description, which includes an interface definition and other information, such as the server's URL. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 11 Web Services  A web service interface generally consists of a collection of operations that can be used by a client over the Internet.  The operations in a web service may be provided by a variety of different resources, for example, programs, objects, databases.  A web service may either be managed by a web server along with web pages; or it may be a totally separate service. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 12 Web Services  Many well-known commercial web services including Amazon, Yahoo, Google and eBay offer web service interfaces that allow client to manipulate their web resources.  As an example, the web service offered by Amazon.com provides operations to allow clients to get information about products, to add an item to a shopping cart or to check the status of a transaction. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 13 Web Services  The Amazon web services may be accessed either by SOAP or by REST (REpresentaional State Transfer).  The provision of a service interface allows its operations to be combined with those of other services to provide new functionality. Figure 2. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 14 Web Services Figure 2. The ‘travel agent service’ combines other web services Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 15 Web Services  A major task of many middleware platforms is to protect the programmer from the details of data representation and marshalling and sometimes with making remote invocations look like local ones.  These things are provided as a part of an infrastructure or middleware platform for web services. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 16 Web Services  At the simplest level, clients and servers may read and write their messages directly in SOAP, using XML. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 17 SOAP (Simple Object Access Protocol)  SOAP is defined to enable both client- server and asynchronous interaction over the Internet.  It defines a scheme for using XML to represent the contents of request and reply messages as well as a scheme for the communication of documents.  Originally, SOAP was based on HTTP, but the current version is designed to use a variety of transport protocols including SMTP, TCP or UDP. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 18 SOAP (Simple Object Access Protocol)  The SOAP specification states:  How XML is to be used to represent the contents of individual messages.  How a pair of single messages can be combined to produce a request-reply pattern.  The rules as to how the recipients of messages should process the XML elements that they contain.  How HTTP and SMTP should be used to communicate SOAP messages. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 19 SOAP (Simple Object Access Protocol)  A SOAP message is carried in an “envelope”.  Inside the envelope there is an optional header and a body as shown in Figure 3. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 20 SOAP (Simple Object Access Protocol) Figure 3. SOAP message in an envelope Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 21 SOAP (Simple Object Access Protocol)  Message headers can be used for establishing the necessary context for a service or for keeping a log or audit of operations.  The message body carries an XML document for a particular web service. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 22 SOAP (Simple Object Access Protocol)  The XML elements envelope, header and body, together with other attributes and elements of SOAP messages are defined as a scheme in the SOAP XML namespace.  Figure 4 shows an example of a simple request message without a header. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 23 SOAP (Simple Object Access Protocol) Figure 4. Example of a simple request without headers Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 24 SOAP (Simple Object Access Protocol)  Figure 5 shows the corresponding successful reply messages, which contains the two output arguments. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 25 SOAP (Simple Object Access Protocol) Figure 5. Example of a reply corresponding to the request in Figure 4 Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 26 SOAP (Simple Object Access Protocol)  A transport protocol is required to send a SOAP message to its destination.  SOAP messages are independent of the type of transport used- their envelopes contain no reference to the destination address. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 27 SOAP (Simple Object Access Protocol)  Figure 6 illustrates how the HTTP POST method is used to transmit a SOAP message. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 28 SOAP (Simple Object Access Protocol) Figure 6. Use of HTTP POST Request in SOAP client-server communication Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 29 SOAP (Simple Object Access Protocol)  The HTTP headers and body are used as follows:  The HTTP headers specify the endpoint address (the URI of the ultimate receiver) and the action to be carried out.  The HTTP body carries the SOAP message.  As HTTP is a synchronous protocol, it is used to return a reply containing the SOAP reply, as shown in Figure 5. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 30 SOAP (Simple Object Access Protocol)  Figure 7 shows a web service interface. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 31 SOAP (Simple Object Access Protocol) package ShapeListService; import java.rmi.*; public interface ShapeList extends Remote { int newShape(GraphicalObject g) throws RemoteException; int numberOfShapes()throws RemoteException; int getVersion() throws RemoteException; int getGOVersion(int i)throws RemoteException; GraphicalObject getAllState(int i) throws RemoteException; } Figure 7. Java web service interface ShapeList Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 32 SOAP (Simple Object Access Protocol)  The Java interface of a web service must conform to the following rules, some of which are illustrated in Figure 7:  It must extend the Remote interface.  It must not have constant declarations, such as public final static.  The methods must throw the java.rmi.RemoteException or one of its subclasses.  Method parameters and return types must be permitted JAX-RPC types. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 33 SOAP (Simple Object Access Protocol)  The class that implements the interface ShapeList is shown in Figure 8. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 34 SOAP (Simple Object Access Protocol) package ShapeListService; import java.util.Vector; public class ShapeListImpl implements ShapeList{ private Vector theList = new Vector(); private int version = 0; private Vector theVersions = new Vector(); public ShapeListImpl(){ version = 0; theVersions = new Vector(); } public int newShape(GraphicalObject g) { version++; theList.addElement(g); theVersions.addElement(new Integer(version)); return theList.size(); } public int numberOfShapes(){ return theList.size(); } public int getVersion() { return version; } public int getGOVersion(int i){ return ((Integer) theVersions.elementAt(i)).intValue(); } public GraphicalObject getAllState(int i) { return (GraphicalObject)theList.elementAt(i); } } Figure 8. Java implementation of the ShapeListserver Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 35 SOAP (Simple Object Access Protocol)  There is no main method, and the implementation of the ShapeList interface does not have a constructor.  In effect, a web service is a single object that offers a set of procedures. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 36 SOAP (Simple Object Access Protocol)  Figure 9 shows the ShapeList client main a call through a proxy. Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 37 SOAP (Simple Object Access Protocol) package staticstub; import javax.xml.rpc.Stub; public class ShapeListClient{ public static void main(String args[]){ try{ Stub stub = createProxy(); stub._setProperty (javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY, args[0]); aShapeList = (ShapeList) stub; System.out.println("Got stub"); int n = aShapeList.numberOfShapes(); System.out.println("Number of shapes=" + n); int v = aShapeList.getVersion(); System.out.println("Version=" + v); Vector sList = new Vector(n); for(int i=0; i<n; i++){ System.out.println("shape no =" + i); GraphicalObject g = aShapeList.getAllState(i); System.out.println("Got shape " + i); int vers = aShapeList.getGOVersion(i); sList.addElement(g); System.out.println("Version number " + vers); g.print(); } Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005

WEB SERVICES 38 SOAP (Simple Object Access Protocol) GraphicalObject g = new GraphicalObject(shapeType,30, 40, 3300, 5500, true); System.out.println("Created graphical object"); int listLength = aShapeList.newShape(g); System.out.println("Stored shape " + shapeType); }catch(Exception e) {System.out.println("allShapes: " + e.getMessage()); } private static Stub createProxy() { return (Stub) (new MyShapeListService_Impl().getShapeListPort()); } Figure 9. Java implementation of the ShapeListclient Couloris,Dollimore and Kindberg Distributed Systems: Concepts & Design Edn. 4, Pearson Education 2005