Remote Procedure Calls
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).
Specifics
-
Diagram of the RPC plumbing.
-
How to build a service interface from scratch.
-
Implement your service interface as a servlet.
-
How to actually make a remote procedure call from the client
-
Using GWT's automatic serialization well.
-
Handle exceptions due to failed calls or thrown from the
server.
-
Asynchronous calls are tricky at first, but ultimately your
users will thank you.
-
Contrasting a couple of approaches to implementing services.