GWT RPC in Eclipse (Live Demo)

A fundamental difference between GWT applications and traditional HTML web applications is that GWT applications do not need to fetch new HTML pages while they execute. Because GWT-enhanced pages actually run more like applications within the browser, there is no need to request new HTML from the server to make user interface updates. However, like all client/server applications, GWT applications usually do need to fetch data from the server as they execute. The mechanism for interacting with a server across a network is called making a remote procedure call (RPC), also sometimes referred to as a server call. GWT RPC makes it easy for the client and server to pass Java objects back and forth over HTTP.

When used properly, RPCs give you the opportunity to move all of your UI logic to the client, resulting in greatly improved performance, reduced bandwidth, reduced web server load, and a pleasantly fluid user experience.

The server-side code that gets invoked from the client is often referred to as a service, so the act of making a remote procedure call is sometimes referred to as invoking a service. To be clear, though, the term service in this context isn't the same as the more general "web service" concept. In particular, GWT services are not related to the Simple Object Access Protocol (SOAP).

RPC Plumbing Diagram

This section outlines the moving parts required to invoke a service. Each service has a small family of helper interfaces and classes. Some of these classes, such as the service proxy, are automatically generated behind the scenes and you generally will never realize they exist. The pattern for helper classes is identical for every service that you implement, so it is a good idea to spend a few moments to familiarize yourself with the terminology and purpose of each layer in server call processing. If you are familiar with traditional remote procedure call (RPC) mechanisms, you will recognize most of this terminology already.

In this screencast tutorial you are going to see how to use the Google Web Toolkit Remote Procedure Calls. This tutorial covers creation of a simple GWT RPC project in Eclipse IDE.

For basic GWT installation instructions, usage of command-line tools, and Eclipse IDE integration see "Google Web Toolkit - Getting Started Screencast".

Eclipse project generation, GWT-RPC plumbing, GWT-RPC Service interface. :

GWT-RPC Service implementation, use of the Java Servlet API, asynchronous service interface, client invocation.

For this tutorial we have used materials from:

  1. Google Web Toolkit - Remote Procedure Calls