Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)



RPC Interfaces

Many GWT applications use GWT RPC to communicate with the backend server. Each RPC service must define a pair of interfaces: the synchronous interface, which is implemented on the server, and the asynchronous interface, which is called by the client-side code. The Google Plugin for Eclipse can help you create and maintain these RPC interfaces via custom errors and quick fixes.

Creating an Asynchronous Interface From a Synchronous Interface

An asynchronous (client-side) RPC interface is very similar to its synchronous (server-side) counterpart. It will usually contain the same methods as the synchronous interface, but the asynchronous methods must each include an additional parameter that represents a callback that is invoked upon completion of the remote call. If your application contains a synchronous interface without a corresponding asynchronous interface, it will be flagged with an error. A set of quick fixes are provided to generate the correct asynchronous interface.

Note: You can change the default severity of any type of problem with Preferences > Google > Errors/Warnings .

Create asynchronous interface quick fix

The first quick fix will launch the New Asynchronous Remote Service Interface wizard, pre-populated with the correct name and location.

Create asynchronous interface wizard

When you click Finish , the asynchronous interface will be generated automatically.

Maintaining Synchronous/Asynchronous Interface Pairs

Correcting mismatched interfaces

If you already have an existing asynchronous interface, the plugin helps you keep it in sync with the synchronous version.

For example, if your synchronous interface contains a method that is not defined on the asynchronous interface, it will generate an error and provide a quick fix to create the asynchronous version of the method. If, however, the method is no longer needed, the second quick fix can remove the unnecessary synchronous method.

Create asynchronous method quick fix

The quick fixes also work in the opposite direction, allowing you to generate synchronous methods from existing methods in the asynchronous interface.

Renaming interfaces or methods

If you need to rename an RPC interface or any of its methods, use the built-in Eclipse rename refactoring and the the plugin will take care of renaming the paired interface or its methods.

Missing or invalid asynchronous callbacks

Every asynchronous method must contain an AsyncCallback as the last parameter. AsyncCallback is a generic type, in which the parameterization must be assignment-compatible with the return type of the synchronous version of the method. The plugin will create an error if the callback parameter is missing or invalid.

Invalid asynchronous callback type

Invalid async return type

When an RPC method is invoked from client-side code, the result (i.e. the return value of the server-side implementation) is returned as a parameter to the onSuccess method of AsyncCallback . Thus, the return type of the asynchronous interface method itself is typically void . However, if you want to have more control over the pending RPC request (e.g. to support cancellation), the asynchronous method can return a Request or RequestBuilder instead.

The plugin will detect any asynchronous methods with invalid return types. The provided quick fix lets you change it to one of the allowed types.

Change asynchronous method return type quick fix

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.