Sunday, 25 September 2011

GWT Tut - RPC

To use RPC, write 3 components:

1.Define (ClientService interface) extends RemoteService & lists all RPC method.
2.Create (ServerServiceImpl class) extends RemoteServiceServlet & implements methods.
3.Define (ClientServiceAsync interface) to be called from client-side code.

Calling the remote procedure call:
1.Create the proxy class
private ClientServiceAsync clientServiceSvc = GWT.create(ClientService.class);
2.Initialize proxy , set up callback object & make call to the remote method.
Initialize: clientPriceSvc = GWT.create(ClientPriceService.class);
Set up callback: AsyncCallback callback = new AsyncCallback() {public void onFailure .... onSucess....}
Call the remote method: clientServiceSvc.getToy(...

No comments:

Post a Comment