Chapter 5 Remote Procedure Call

Slides:



Advertisements
Similar presentations
Message Passing Vs Distributed Objects
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.
RPC Robert Grimm New York University Remote Procedure Calls.
Remote Method Invocation
FONG CHAN SING (143334) WONG YEW JOON (143388). JAVA RMI is a distributive system programming interface introduced in JDK 1.1. A library that allows an.
6/11/2015Page 1 Web Services-based Distributed System B. Ramamurthy.
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.
Lecture 10: Web Services. Outline Overview of Web Services Create a Web Service with Sun J2EE (JAX-RPC)
Sockets  Defined as an “endpoint for communication.”  Concatenation of IP address + port.  Used for server-client communication.  Server waits for.
EEC-681/781 Distributed Computing Systems Lecture 5 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University
Java RMI, JAX-RPC and JWSDP
How Does Remote Method Invocation Work? –Systems that use RMI for communication typically are divided into two categories: clients and servers. A server.
.NET Mobile Application Development Remote Procedure Call.
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.
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.
T Network Application Frameworks and XML Web Services and WSDL Sasu Tarkoma Based on slides by Pekka Nikander.
Grid Computing, B. Wilkinson, 20043b.1 Web Services Part II.
COP 4991 Component Based Software Development Lecture #4 Java Web Services Onyeka Ezenwoye.
15 - RMI. Java RMI Architecture Example Deployment RMI is a part of J2SE (standard edition), but is used by J2EE) A J2EE server is not nessesary for using.
Silberschatz, Galvin, and Gagne  1999 Applied Operating System Concepts Chapter 15: Distributed Communication Sockets Remote Procedure Calls (RPCs) Remote.
RMI remote method invocation. Traditional network programming The client program sends data to the server in some intermediary format and the server has.
XML and Web Services (II/2546)
Chapter 5: Distributed objects and remote invocation Introduction Remote procedure call Events and notifications.
Web Services An Introduction Copyright © Curt Hill.
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.
Remote Method Invocation A Client Server Approach.
UMBC Distributed Computing with Objects RMI/Corba CMSC 432 Shon Vick.
DEVELOPING WEB SERVICES WITH JAVA DESIGN WEB SERVICE ENDPOINT.
Distributed Computing & Embedded Systems Chapter 4: Remote Method Invocation Dr. Umair Ali Khan.
Beginning 자바 웹 서비스 웹 서비스 호출 Meilan JIANG Cyber infrastructure Research Laboratory Department of Advanced Technology.
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 Distributed Computing
Java Web Services Orca Knowledge Center – Web Service key concepts.
03 – Remote invoaction Request-reply RPC RMI Coulouris 5
Web Programming Developing Web Applications including Servlets, and Web Services using NetBeans 6.5 with GlassFish.V3.
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.
WEB SERVICES.
WSDL JAX-RPC 17th October 2004
T Network Application Frameworks and XML Web Services and WSDL Sasu Tarkoma Based on slides by Pekka Nikander.
Writing simple Java Web Services using Eclipse
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.
Java Distributed Computing
Unit – 5 JAVA Web Services
Broker in practice: Middleware
Remote Method Invocation
What is RMI? Remote Method Invocation
Edition 5, © Addison-Wesley 2012
Programming Models for Distributed Application
Chapter 9 Web Services: JAX-RPC, WSDL, XML Schema, and SOAP
Lecture 4: RPC Remote Procedure Call Coulouris et al: Chapter 5
CSSSPEC6 SOFTWARE DEVELOPMENT WITH QUALITY ASSURANCE
Introduction to Web Services
Lecture 4: RPC Remote Procedure Call CDK: Chapter 5
Introduction to Web Services
Understanding Web Services based on dev. java
Creating a Distributed System with Remote Procedure Calls and Web Services Ch.5 B.Ramamurthy 2/17/2019 B.Ramamurthy.
Quiz Points 4 Rules Raise your hand if you know the question
Distribution Infrastructures
WebServices Using JAX-RPC
Introduction to Web Services
Distributed System using Web Services
WEB SERVICES From Chapter 19, Distributed Systems
Chapter 42 Web Services.
Remote invocation (call)
Java Remote Method Invocation
Distributed System using Web Services
CSE 451: Operating Systems Messaging and Remote Procedure Call (RPC)
Presentation transcript:

Chapter 5 Remote Procedure Call From Coulouris, Dollimore, Kindberg and Blair Distributed Systems: Concepts and Design

Request-Reply Protocol Client Server Request doOperation message getRequest select object (wait) execute method Reply message sendReply (continuation)

Request-Reply Protocol public byte[] doOperation (RemoteRef s, int operationId, byte[] arguments) sends a request message to the remote server and returns the reply. The arguments specify the remote server, the operation to be invoked and the arguments of that operation. public byte[] getRequest (); acquires a client request via the server port. public void sendReply (byte[] reply, InetAddress clientHost, int clientPort); sends the reply message reply to the client at its Internet address and port.

Request-Reply Protocol messageType requestId remoteReference operationId arguments int (0=Request, 1= Reply) int RemoteRef int or Operation array of bytes

RPC Architecture client Request Reply Communication module dispatcher service client stub server stub procedure client process server process program

JAX-RPC: Java API for XML-based Remote Procedure Call (RPC). An API for building Web Services and Web Services clients. JAX-RPC is designed to provide a simple way for developers to create Web services server and Web services client. Based on remote procedure calls; so the programming model is familiar to Java developers.

Web Service Client and Servers JAX-RPC maps a web service operation to a java method call. service endpoint to a Java Interface. Thus one way to begin implementation of a web service in JAX-RPC is to define a Java interface with a method for each operation of the service along with a class that implements the interface, following the rules of remote invocation etc.

JAX-RPC Service Creation A service definition describes the operations that it provides and the data types that they require as argument and provide as return values. This definition can be made available as a document written in WSDL. From a WSDL document, JAX-RPC can generate the Java code required to connect a client to a server leaving one to write only the logic of the client application itself. Since WSDL is language independent the server can be in .net, Jax- rpc or any other compatible platform. Define the service a Java interface. Generate WSDL using the tools provided with JAX-RPC package. Advertise it in a registry for the client to lookup and import it. For publication and lookup any other technology such as J2EE can be used

Interface Method Invocation Interface must extend java.rmi. Remote Must declare that it throws java.rmi.RemoteException May declare other service-dependent exceptions such as java.lang.Exception May be derived as extensions from other interfaces.

Client and Server Programming Environment JAX-RPC API is distributed over a set of packages: javax.xml.rpc javax.xml.rpc.encoding javax.xml.rpc.handler javax.xml.rpc.handler.soap javax.xml.rpc.holders javax.xml.rpc.server javac.xml.rpc.soap

Stubs and Ties Client Side: Stub object has the same methods as the service implementation class. Client application is linked with the stub. When it invokes a method stub delegates the call to the JAX-RPC runtime so that appropriate SOAP message can be sent to the server. On completion the result return back in the reverse path as above. Server side: Message received must be converted into a method call on actual service implementation. This functionality is provided by another piece of glue called tie. Tie extracts method name and parameter from SOAP message. Tie also converts the result of the method call back into a response message to be returned to client JAX-RPC runtime. Developer need not write these classes (tie and stub) since JAX-RPC comes with tools to generate them.

JAX-RPC Architecture for Hello Example Hello Client JAX-WS Stub JAX-WS Runtime (APIs) Transport Hello Service Endpoint Impl JAX-WS Ties JAX-WS Runtime (APIs) Transport SOAP/HTTP

JAX-RPC Procedures To call a remote procedure, the Client program invokes a method on a stub, a local object that represents the remote service.  The stub invokes routines in the JAX-RPC runtime system.  The runtime system converts the remote method call into a SOAP message and then transmits the message as an HTTP request.  When the server receives the HTTP request, the JAX-RPC runtime system extracts the SOAP message from the request and translates it into a method call.  The JAX-RPC runtime system invokes the method on the tie object.  The tie object invokes the method on the implementation of the service.  The runtime system on the server converts the method's response into a SOAP message and then transmits the message back to the client as an HTTP response.  On the client, the JAX-RPC runtime system extracts the SOAP message from the HTTP response and then translates it into a method response for the program.

Building and Deploying Service Code the service definition interface, implementation and publisher class.  Compile the service definition code of step 1.  Package the code in a WAR file.  Generate the ties and the WSDL file.  Deploy the service.

Coding the Interface and Implementation Class The interface extends java.rmi.Remote interface. No constant declarations allowed. Methods must throw java.rmi.RemoteException Method parameters and return types must be supported by JAX-RPC types.

Create Endpoint Interface

Create Endpoint Implementation

Create Endpoint Publisher

Compiling and Packaging To compile: ant compile-server To package: ant setup-web-inf ant package Note: These two commands will generate and place the executables in appropriate directories.

Generating Ties and WSDL Files and Deploy Service To generate Ties and WSDL: ant process-war Will invoke wsdeploy to generate the tie classes and the WDSL file MyHello.wsdl To deploy the service: ant deploy To verify deployment: http://localhost:8080/hello-jaxrpc/hello To undeploy: ant undeploy

Building and Running Client Generate the stubs. Code the client. Compile the client code. Package the client classes into a JAR file. Run the client.

Generating Stubs and Coding the Client To generate stubs: ant generate-stubs Before generating stubs, be sure to install the Hello.wsdl file Unpack the WAR file using wsdeploy and location WSDL file in WEB-INF directory or use command: wsimport –keep http://localhost:9999/ws/hello?wsdl Coding the client: is a stand alone program. It calls the service through the generated stub which acts as a proxy for the remote service.

Compiling, Packaging and Running Compile the client code: ant compile-client Package the client: ant jar-client Running the client: ant run

Iterative Development Test the application. Edit the source files. Execute ant build to create and deploy war files. Execute ant redeploy to undeploy and deploy the service. Execute ant build-static to create jar files with static stubs. Execute ant run to run the client.