The following steps describe how to implement a service using GWT RPC:
Define the main service interface
Define the callback (Async) version of the service interface
If the main interface is
FooService
, defineFooServiceAsync
Make the service servlet
Extend the
RemoteServiceServlet
, implement theservice
interfaceSupply the URL-pattern in
web.xml
that matches the relative path
Create and use the service proxy
A service implementation must extend RemoteServiceServlet
and must implement the associated service interface. Notice that the service implementation does not implement the asynchronous version of the service interface. Every service implementation is ultimately a servlet, but rather than extending HttpServlet
, it extends RemoteServiceServlet
instead. RemoteServiceServlet
automatically handles serialization of the data being passed between the client and the server and invokes the intended method in your service implementation.