To invoke an Integration service, use the SDK class GetIntegrationService() method to get the service object. To invoke an operation, use the returned IntegrationService object.
This API retrieves an IntegrationService instance with the specified service name.
IntegrationService GetIntegrationService(string serviceName)
serviceName
The name of the service.
Returns an IntegrationService object.
System.Exception
The API throws this exception when not initialized, the claim token is undefined, or the service is undefined.
// Sample code to fetch the integration service details. Kony.KonyService integrationSvc; var serviceName = < your - service - name > ; try { integrationSvc = sdkObject.GetIntegrationService(serviceName); } catch (Exception e) { Console.WriteLine("Invalid Service"); }
The InvokeOperation method invokes the specified operation. This method may take a few seconds, so it is available as either a synchronous or asynchronous call.
Synchronous
JObject InvokeOperation(string operationName, Dictionary<string, string> headers, Dictionary<string, string> parameters)
Asynchronous
async Task<JObject> InvokeOperationAsync(string operationName, Dictionary<string, string> headers, Dictionary<string, string> parameters)
operationName
The name of the operation.
headers
HTTP request header key value pairs.
parameters
HTTP request parameter key value pairs.
Returns an HTTP Response as a JSON object.
Kony FabricException
The InvokeOperation method throws this exception when either Name or URL is either empty or null.
Asynchronous
// Sample code to invoke the specified operation asynchronously.// sdk.Object is the SDK object. string serviceName = < your - service - name > ; string operationName = < your - operation - name > ; Dictionary < string, string > params = new Dictionary < string, string > (); Dictionary < string, string > headers = new Dictionary < string, string > (); JObject result; try { integrationSvc = sdkObject.GetIntegrationService(serviceName); result = await integrationSvc.InvokeOperationAsync(operationName, headers, params); } catch (Exception e) { if (integrationSvc == null) { Console.WriteLine("Invalid Service"); } else { Console.WriteLine("Invoke operation failed"); } }
Copyright © 2020 Kony, Inc. All rights reserved. |