mPaaS provides the H5 container as a mobile web solution for JavaScript (JS) front ends. It runs on Android and iOS and requires client-side integration.
After H5 container integration, the front end can use the gateway to:
-
Encapsulate client-server communication through a dynamic proxy.
-
Auto-generate and export client code when client and server interfaces match.
-
Handle
RpcExceptionerrors uniformly with dialogs or toast messages.
Prerequisites
The H5 container is integrated into your Android or iOS client. Integrate with Android, Integrate with iOS.
Generate JS code
Connect your app's backend service to the Mobile Gateway console to generate an RPC JS SDK for client calls. Generate Code.

The system generates a code template for each API based on its interface parameters:
var params = [{
"_requestBody":{"userName":"", "userId":0}
}]
var operationType = 'alipay.mobile.ic.dispatch'
AlipayJSBridge.call('rpc', {
operationType: operationType,
requestData: params,
headers:{}
}, function (result) {
console.log(result);
});
To make an RPC call, populate this template with the required request parameters.
Call an RPC interface
Example RPC interface call from JS:
AlipayJSBridge.call('rpc', {
operationType: 'alipay.client.xxxx',
requestData: [],
headers:{}
}, function (result) {
console.log(result);
});
Parameters
|
Parameter |
Type |
Required |
Default |
Description |
|
operationType |
string |
Yes |
RPC service name. |
|
|
requestData |
array |
Yes |
RPC request parameters. Construct based on the target RPC interface. |
|
|
headers |
dictionary |
Yes |
{} |
RPC request headers. |
|
gateway |
string |
Yes |
alipay gateway |
The gateway address. |
|
compress |
boolean |
Yes |
true |
Enables gzip compression for the request. |
|
disableLimitView |
boolean |
Yes |
false |
Disables the automatic rate-limiting dialog from the RPC gateway. |
Request result
|
Result |
Type |
Description |
|
result |
dictionary |
RPC response. If the value is a string, it is wrapped in a dictionary with the key |
Error codes
|
Error code |
Description |
|
10 |
Network error. |
|
11 |
Request timeout. |
|
Others |
Defined by the mobilegw gateway. |