Kony Fabric console User Guide: SDKs > Kony Visualizer SDK > Invoking an Integration Service

Invoking an Integration Service

This API invokes an integration service that is configured in the Kony Fabricportal.

// 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 is a time out value for the HTTP connection. This can also be referred as connection time out value in seconds.
timeoutIntervalForResource int This 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)

Enables HTTP request calls in background in iOS.

Note: This may lead to duplicate transactions in the system, should only be used for GET calls. iOS internally retries the request to keep the connection alive till it reaches timeoutIntervalForResource value, which may create duplicate transactions in back end.

 

xmlHttpRequestOptions Datatype Comments
enableWithCredentials true/false To allows CORS requests in SPA

 

Copyright © 2019 Kony, Inc. All rights reserved.