Invoking an Integration Service
This API invokes an integration service that is configured in the Quantum Fabric portal.
// Sample code to fetch the integration service details var serviceName = "integration_service_name"; // Get an instance of SDK var client = kony.sdk.getCurrentInstance(); var integrationSvc = client.getIntegrationService(serviceName); var operationName = "operation_name"; var params = { "custom-input-key1": "custom-input-value1" }; var headers = { "custom-header-key1": "custom-header-value1" }; //If there are no headers,pass null // options is an optional parameter that helps in configuring the network layer. // To configure for a thin layer, use xmlHttpRequestOptions instead of httpRequestOptions.
// Values for timeoutIntervalForRequest and timeoutIntervalForResource are in seconds. // If the request is failing because the network is unreliable, you can provide the following values: // timeoutIntervalForRequest: This is the time taken by the client to receive headers. This is in seconds. // timeoutIntervalForResource: The timeout for each chunk download. This is in seconds. var options = { "httpRequestOptions": { "timeoutIntervalForRequest": 60, "timeoutIntervalForResource": 600 } }; integrationSvc.invokeOperation(operationName, headers, params, function(response) { kony.print("Integration Service Response is: " + JSON.stringify(response)); }, function(error) { kony.print("Integration Service Failure:" + JSON.stringify(error)); }, options);
NOTE: The client is the kony.sdk(); object.
httpRequestOptions | Datatype | Comments |
---|---|---|
timeoutIntervalForRequest | int | This option is a time out value for the HTTP connection. This is also referred to as connection time out value in seconds. |
timeoutIntervalForResource | int | This option is used to give a maximum time in seconds for which the network resource should be kept alive on iOS device. This is only applicable for background network calls and default value is 1 week (7 days) unless specified in options. |
enableBackgroundTransfer | boolean (true/false) |
This option enables HTTP request calls in background in iOS. NOTE:
This may lead to duplicate transactions in the system and must only be used for GET calls. |
xmlHttpRequestOptions | Datatype | Comments |
---|---|---|
enableWithCredentials | boolean (true/false) |
This option allows CORS requests in single-page applications (SPA). |
Error Codes for Failure Callbacks for Integration Services
Error Code | Error Message |
---|---|
100 | UnhandledMFcode |
101 | Invalid User Credentials. |
102 | Invalid App Credentials. |
103 | Invalid User/App Credentials. |
104 | Session/Token got invalidated in the backend. Please login. |
105 | Invalid provider in appServices. |
106 | Claims Token is Unavailable |
1000 | An unknown error has occurred |
1011 | An error occurred while making the request. Please check device connectivity, server url and request parameters |
1013 | Invalid JSON response was returned |
1014 | Request to server has timed out |