All Kony Fabric Posts

Taking a Test Drive with Cordova and MobileFabric 

Suhas Bhat - Jul 18, 2016 - Engineering

Services of Kony’s MobileFabric can be invoked by various front end applications including Cordova. In this blog post Muralidhar Seelam (Reddy) discusses Kony’s AWS TestDrive that is titled “Connecting Cordova to MobileFabric” which showcases the ease of integrating Cordova applications with services configured in Kony’s MobileFabric. 

 

Amazon Web Services (AWS) Test Drive provides a private IT sandbox environment containing preconfigured server based solutions

This test drive contains a video that provides an overview of the labs and also detailed user guides which walks the user through the step by step process to sign up for the test drive and run the applications of the test drive. 

In this test drive, we will walk you through two Cordova applications, as part of two 

different labs, that seamlessly integrate with the services that are exposed by 

MobileFabric. We also provide an overview of the applications, reviewing the services that are exposed for the applications in MobileFabric, steps to publish the services of MobileFabric, Configuration of the client application and finally the execution 

of the Cordova applications in a preconfigured Android emulator. 

This test drive is intended for mobile architects and developers to create 

Cordova applications that need to use the Mobile Backend as a Service (MBaaS) services that are exposed using Kony’s MobileFabric server.

 

News and Weather Application

The “News and Weather”  application is a sample application created using Cordova to demonstrate how easy it is to connect Cordova applications to enterprise services based on SOAP, XML, JSON or other protocols. This sample application, News & Weather App, uses the Google’s REST based service for news and CDYNE’s SOAP service for current weather and weather forecast. Both these services are not optimized for a mobile device and use two separate protocols to convey information from their services. In both cases, the services send back more data than will be needed for our mobile application. In the case of a mobile app, it’s ideal to send back a concise response that reduces bandwidth needs. In this lab, MobileFabric will be used to expose these services to news and weather app as mobile optimized, REST based services that are easily ingested by the Cordova application.

The News and Weather application will use three integration services and one orchestration service that will be setup and configured on the test drive’s AWS cloud of the MobileFabric. The integration services will be used to display the Top Stories, US news, World News etc. and the orchestration service will be used to display the local news along with the weather (current and forecast) information in the client application.

Below is the quick overview of the functionality provided using the orchestration services that are set up in the MobileFabric test drive. The application uses three web services from three different sources. Instead of the mobile app making all three service calls and the developer managing both the XML/REST and SOAP based responses, the app will make a single call to MobileFabric. MobileFabric will invoke each of the requests to these services and return a single, concise JSON response back to the app. MobileFabric handles the complexity of converting the responses, and the end developer doesn’t need to orchestrate the calls within his or her code. 

Below is a breakdown of the steps in the application:

1. The client application invokes the “LocalNewsWeather” operation of the “NewsAndWeather” orchestration service providing the latitude and longitude of a city. The “NewsAndWeather” service invokes the REST service of openstreetmap.com to retrieve the city name and zip code.

2. The “LocalNewsWeather” operation then invokes the “CompositeNewsWeather” operation of the same service using the city name and the Zip code.

3. The “CompositeNewsWeather” service invokes the news.google.com’s XML/REST service in the back end with the city name to retrieve the news of the city. It also invokes the wsf.cdyne.com SOAP service to retrieve the current weather and the weather forecast information using the city’s zip code.

4. The “NewsAndWeather” service then combines the responses from both these services and returns a concise response back to the invoking service.

 

CRM App

The CRM App is sample application that uses SalesForce CRM as the back end and shows the capability of the MobileFabric in identifying the exposed services via business connectors. It also shows how to configure the retrieved data and provide it to the client app for online use.

The CRM application of the MobileFabric that is configured in this test drive, will demonstrate the capability of the MobileFabric to discover and display the data of the SalesForce back end services.

For the CRM application, the test drive walks you to first sign up for a SalesForce trial account, create a new app in the SalesForce which will provide the consumer key and consumer secret, white list the IP address of the test drive’s MobileFabric in SalesForce, modify the existing identity service of the MobileFabric with the new consumer key and consumer secret, modify the existing services of SalesForce with the new SalesForce user id and password and launching the Cordova client application in an android emulator.

This test drive also covers the steps needed for the minimal configuration of the MobileFabric services, which connect to the SalesForce back end and retrieve the data. We will also take you on a quick tour of how a new MobileFabric service is created and tested and also provide a quick review of the Cordova client side code of CRM App.

When a new SalesForce account is created, SalesForce populates the objects with data. For this lab, we will leverage this existing SalesForce back end data of the new account.

The CRM App will use one identity service and three integration services that will be setup and configured on the test drive’s AWS cloud of the MobileFabric. The identity service will use the built in SalesForce adapter along with the user’s SalesForce credentials to connect to SalesForce. The integration services will discover the metadata of the exposed objects of SalesForce and provide the operations, which will be invoked by the Cordova client application.

 

 

Below is the quick overview of the functionality provided using the services that are the set up

in the MobileFabric test drive.

1. The client side Cordova application connects to the MobileFabric using the app Key and app Secret of the published MobileFabric application. 

2. The MobileFabric’s identity service that is configured with your SalesForce Customer Key and Secret will authenticate against SalesForce’s authentication mechanism.

3. The ContactIntgServiceTD, AccountIntgServiceTD, OpportunityIntgServiceTD and LeadIntgServiceTD services that are set up in MobileFabric will discover the metadata of the Contact, Account, Opportunity and Lead objects of SalesForce and will perform the required response XPath mappings.

4. The ContactIntgServiceTD, AccountIntgServiceTD, OpportunityIntgServiceTD and LeadIntgServiceTD services return the data that is needed by the Cordova client application.

 

Next Steps

To sign up for the “Connecting Cordova to MobileFabric” test drive, log on to https://kony.orbitera.com/c2m/customer/signup