javascriptcross-platformtemenos-quantum

How to invoke an Integration Service in Kony Studio that is created in the MobileFabric Console?


I am trying to invoke an integration service in a JavaScript module in Kony Studio. Previously I created the service "TestService" with the operation "getPostsByUserID" in the MobileFabric console. The service calls an API that returns an JSON object. I want to use the returned data in my app.
If I test the app on the simulator I get the error Invalid serviceName from the Kony SDK.

I've met the following prerequisites:

  1. The app is published to the Kony Server.
  2. I initialized the Kony SDK.
  3. The names of the service and the operation are correct. I checked this several times.

Does anybody have an advice what I missed?

function getPosts () {
    serviceName = "TestService";
    integrationObj = client.getIntegrationService(serviceName);
    integrationObj.invokeOperation("getPostsByUserID", {}, {userID: 1}, successCallback, failureCallback);

    function successCallback (res) {
        alert('success: ' + res);
    }

    function errorCallback (res) {
        alert('error' + res);
    }
}

client is the intialized Kony SDK object.


Solution

  • I got it. Everytime I make a change on the Integration Services in the MobileFabric console I have to:

    1. Re-Publish the app in the console. This is somehow the submit button to apply changes.
    2. Synchronize it with the Kony Studio app via application properties -> MobileFabric. So the app knows that the service exists at all.