Making Remote Procedure Calls (RPC) with Google Web Toolkit (GWT)10 Sep 2012
GWT provides framework for exchanging Java objects between Client and Server components of web application over HTTP. In GWT, RPC service is defined by an interface that extends the GWT RemoteService Interface.
Creating GWT Service
In order to define RPC, you need to write three components
- Define Interface in Client Side for your Service that extends RemoteService and list RPC method call.
- Define Service Class in Server side that extends RemotServiceServlet.
- Add Servlet information to the web.xml file
- Add @RemoteServiceRelativePath information to the Interface class on the client side.
- Define an Asynchronous interface to the service to be called from the client-side code.
Calling GWT Service
For calling GWT Service you need to instantiate a service interface using GWT.create();
We need to specify service entry point URL for the service using ServiceDefTarget
And finally create a AsynCallback object so that client can be notified when service call is completed.
And at the end Make a call to the service with specific callback attached to it.Tweet Follow @aayushtuladhar