Remote Procedure Call (RPC) Adapter
Web-remoting is a pattern that provides support for JavaScript™ or client-side code to directly invoke server side logic. This pattern provides the ability to invoke Java™ methods from JavaScript. The invocation is by means of a JSON-RPC call. The most common usage is asynchronous calls with XmlHttpRequest. Data is transferred between the server and client in JSON format. Therefore, this pattern is essentially a form of JSON Web services.
The IBM® implementation for Web remoting is referred to as the RPC adapter for IBM. The RPC adapter is designed to help developers create command-based services quickly and easily in a manner that complements programming styles for Ajax applications and other lightweight clients. Implemented as a generic servlet, the RPC adapter provides an HTTP interface to registered JavaBeans™.
The RPC adapter provides an HTTP interface to Registered JavaBeans. It will deserialize the input and call the corresponding method in the JavaBean. It will serialize the output from the JavaBean to JSON/XML format.
The RPC adapter currently supports two RPC protocols:
- HTTP RPC, which encodes RPC invocations as URLs with query parameters, for HTTP GET, or form parameters, for HTTP POST.
- JSON-RPC, supports the SMD service descriptor employed by the Dojo dojo.rpc.JsonService API.
HTTP RPC
In HTTP RPC, invocations are made using URLs with query parameters or form parameters. The RPC adapter intercepts and deserializes the URL to get service name, method name, and input parameters. Using these information RPC adapter invokes the corresponding method of matching JavaBeans.
JSON-RPC
In JSON-RPC, method invocation is made using JSON objects. The response generated is also a JSON object. The registered JavaBeans can be accessed through the Dojo JSON-RPC API.
Related tasks
Accessing JEE data (Web remoting)
Enabling ATOM and RSS feed syndication support
Creating Rich Internet Applications (RIA)