0

I have embedded a GWT RPC call within onModuleLoad method and this RPC call does not seem to be executing the onSuccess method. Within the RPC implementation at the server side it works well with debug print statements.

Code snippet below,

public void onModuleLoad() {

        System.out.println("ON MODULE LOAD");

        mobiTeamService.login(GWT.getHostPageBaseURL(), new AsyncCallback<LoginInfo> () {

               public void onFailure(Throwable error) { System.out.println("FAILURE"); ClientSideUtils.logError(mobiTeamService, CLS,error) ;}

               public void onSuccess(LoginInfo result) {

                   System.out.println("ON SUCCESS: " + result) ;

                   loginInfo = result ;
}
}) ;
}
Philippe Gonday
  • 1,747
  • 5
  • 21
  • 32

1 Answers1

0

Ensure that you have done the below steps (GWT-RPC), if so then the onSuccess will be definitely executed.

  • Interface(MobiTeamService) should be extending RemoteService(com.google.gwt.user.client.rpc.RemoteService)
  • AsynInterface(MobiTeamServiceAsync) should be in the same package where your interface resides.
  • MobiTeamServiceImpl should be extending RemoteServiceServlet and implementing MobiTeamService interface
  • Map your MobiTeamServiceImpl servlet in the web.xml, a servlet entry and its mapping
  • If you have specific path for accessing the service, then the path defined on the interface(MobiTeamService) by tag RemoteServiceRelativePath should be matching with the url pattern entry in the web.xml

You can also go thru this tutorial to get more understanding on GWT-RPC http://www.gwtproject.org/doc/latest/tutorial/RPC.html

Clement Amarnath
  • 5,301
  • 1
  • 21
  • 34
  • Thanks for the prompt response. I figured out that the callback is working but System.out.print statements within onModuleLoad does not go to eclipse console. When I added a Window.alert was able to debug the code. Just curious what is the stdout for print statements called from within onModuleLoad method. – user1434130 Oct 08 '15 at 12:59
  • 1
    Gwt logging will help you for printing the logs in console. http://stackoverflow.com/questions/9247424/how-to-print-to-the-console-in-gwt – Clement Amarnath Oct 08 '15 at 13:05