1

I am wondering why you also need to define a synchonous interface when using GWT RPC as all calls are asynchornous (http://www.gwtproject.org/doc/latest/DevGuideServerCommunication.html)?

I do not see where the synchornous interface is used!

i.e. why can't we just implement the synchonous interface in our service implementation class?

1 Answer 1

0

From the documentation:

http://www.gwtproject.org/doc/latest/DevGuideServerCommunication.html#DevGuideCreatingServices

This synchronous interface is the definitive version of your service's specification. Any implementation of this service on the server-side must extend RemoteServiceServlet and implement this service interface.

package com.example.foo.server;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import com.example.client.MyService;


public class MyServiceImpl extends RemoteServiceServlet implements
    MyService {

  public String myMethod(String s) {
    // Do something interesting with 's' here on the server.
    return s;
  }
}

Tip: It is not possible to call this version of the RPC directly from the client. You must create an asynchronous

5
  • Does it mean that my serviceimplementation is interacting with the synchronous interface and not the async? but the call is async? I don't understand it fully from reading the documentation on the gwt projects homepage.
    – John
    Nov 19, 2014 at 12:17
  • I found this article about MarkerInterface which RemoteService is, but it does not say how and for what the RemoteService is used and the connection to GWT: javarevisited.blogspot.dk/2012/01/…
    – John
    Nov 19, 2014 at 12:29
  • The synchronous interface does two things: first it is used on the server side, second it triggers the generation of the rpc proxy.
    – El Hoss
    Nov 19, 2014 at 13:56
  • Where is the connection between the synchonous class and the async class?
    – John
    Nov 19, 2014 at 16:33
  • 1
    asynchronous interface used on the client side, synchronous interface is used on the server side and it is used by GWT to identify the code generator. The synchronous always extends RemoteService, which will tell GWT to use RpcServiceGenerator.
    – El Hoss
    Nov 19, 2014 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.