The RPC adapter for IBM® WebSphere® Application Server is provided as a standalone package. Let us assume that <install_root> is the directory where WebSphere Application Server is installed,
Standalone Library:
The IBM RPC adapter is provided as a stand-alone library in the <install_root>/optionalLibraries/web2mobile/RPCAdapter
directory. Note that you also
need to create and add a RpcAdapterConfig.xml file in the WEB-INF directory.
The standalone library can be used with
Web applications or Enterprise Applications that need to invoke methods of JavaTM objects from JavaScriptTM. Installation of this library is
dependent on how the application that uses it is packaged and
implemented. A few general scenarios are provided.
Java Platform, Enterprise Edition (Java EE) Web application:
Place the RPCAdapter.jar file in the WEB-INF/lib directory of the Web application containing the Java objects that
you want to make accessible.
Configure the web.xml file so that the servlet com.ibm.websphere.rpcadapter.RPCAdapter is exposed under
the Web address: http://<host>:<port>/<contextRoot>/RPCAdapter/*. Add the following servlet configuration
to your web.xml file:
RPCAdapterRPCAdaptercom.ibm.websphere.rpcadapter.RPCAdapterRPCAdapter/RPCAdapterRPCAdapter/RPCAdapter/*
This is for routing all calls to the application with RPC adapter in the URL to the com.ibm.websphere.rpcadapter.RPCAdapter servlet.
Create a RpcAdapterConfig.xml and place it in the WEB-INF folder.
Specify the POJO that are exposed through RPC adapter in the configuration file. An example of a basic configuration
that exposes a TestService follows:
xmlTestServicecom.ibm.test.TestServicebean provides ...
Start the application server.
Package and deploy the Web application. Refer to the application server specific documentation on
instructions for packaging and deploying a Web archive (WAR) or Enterprise archive (EAR) file.
Use the following directory of URLs to interact with the RPC adapter for information and RPC:
GET <baseUrl>/httprpc -- directory of registered services
GET <baseUrl>/httprpc/<serviceName> -- list of operations on <serviceName>
GET <baseUrl>/httprpc/<serviceName>/<operation>[?name=value] -- HTTP RPC invocation
POST <baseUrl>/httprpc/<serviceName>/<operation> [BODY: name=value] -- HTTP RPC invocation
GET <baseUrl>/jsonrpc/<serviceName> -- Dojo SMD file
POST <baseUrl>/jsonrpc/<serviceName> [BODY: JSON-RPC request] -- JSON RPC invocation
Use Dojo to invoke the services exposed through RPC adapter using the dojo.rpc.JsonService script. Refer to the Dojo documentation on detailed usage information.