The Mirata Forms OData Interface Layer (FOIL) is an SAP Business Technology Platform (BTP) application implemented using the SAP Cloud SDK for JavaScript and the NestJS platform.
Mirata Forms functionality can be tightly integrated with an SAP Mobile Development Kit (MDK) application, such as SAP Service and Asset Manager. This is accomplished using a Mirata MDK control extension that is built into a custom branded version of the MDK Client. Custom metadata is used to interface the base version of the MDK mobile application with the Mirata MDK control extension and with the Mirata cloud-based data services.
The SAP MDK mobile platform only allows for the exchange of data with an OData-based data source. The purpose of the Mirata FOIL application is to implement an OData data interface layer between a “mobile destination” of an MDK application deployed to BTP Mobile Services and a Mirata RESTful cloud-based API endpoint. FOIL receives HTTP-based OData query and data modification requests from BTP Mobile Services and makes the appropriate corresponding RESTful API call to the Mirata API endpoint specified by the MDK application’s destination definition. FOIL then receives JSON-formatted data from the Mirata API endpoint, transforms it into JSON data that meets on the OData v2 specification, and returns the data as a response to the original OData-based HTTP request received from BTP Mobile Services.
The Mirata FOIL application has two BTP service dependencies. The first is an XSUAA (eXtended Services for User Account and Authentication) service. The XSUAA service provides an OAuth/OIDC interface to BTP applications that require a user authentication service, and a SAML interface to an identify provider (or "IdP") service. Note that SAP BTP accounts provide a default trusted SAML-based interface to SAP's standard IdP (SAP ID Service). However, this interface is typically replaced with a SAML-based interface to a company-managed IdP.
A “trust relationship” is also established between the Mirata cloud-based IdP and the BTP IdP, such that the Mirata IdP recognizes and accepts users authenticated by the BTP IdP. The XSUAA service that is created during the FOIL installation manages the exchange of information in this trust relationship. This IdP trust configuration enables the FOIL application to authenticate with the Mirata IdP service on behalf of an MDK mobile application user (who has previously authenticated with the BTP-managed IdP) when Mirata Forms data is requested by a Mirata Forms-enabled MDK mobile application.
The other BTP service required by a Mirata FOIL application is a "destination" service that maintains and provides data used to establish a connection to a Mirata cloud-based API endpoint.
The FOIL installation software is provided in a Zip archive file (foil.zip). Expand this archive file into an empty file system directory.
Note: In the upcoming installation procedures, this directory is referred to as the “Mirata FOIL software directory”
The upcoming installation procedures require editing a FOIL configuration file. The text-based configuration file is composed of a JSON (JavaScript Object Notation) object, and all edits to the configuration file must conform to proper JSON syntax.
Before building and deploying the FOIL XSUAA service, its configuration file must be updated with information specific to your company's BTP account. Specifically, the Server API URL from the Mobile Services service instance that will host the Mirata Forms-enabled MDK mobile application must be obtained and added to the formsxsuaa.xssecurity.json configuration file. If multiple Mirata Forms-enabled MDK mobile application instances are being hosted, the Server API URL from each mobile application instance must also be added to the same configuration file. If a new Mirata Forms-enabled MDK mobile application instance is deployed to BTP Mobile Services after the FOIL XSUAA Service has been installed, the same configuration file must be updated accordingly, after which the FOIL XSUAA Service must be updated accordingly.
To avoid defining multiple Server API URL entries in the formsxsuaa.xssecurity.json file, the * (asterisk) character can be used as a "wildcard" to qualify multiple mobile applications published to the same Mobile Services instance. Typically, the first segment of each Server API URL is specific to the mobile application, and the remainder of the URL is common to the hosting Mobile Services instance. Inserting an * (asterisk) in place of the first URL segment establishes a single entry in formsxsuaa.xssecurity.json that covers all current and future Mirata Forms-enabled mobile applications that may be added to the Mobile Services instance.
For example, if the Server API URLs for three Mirata Forms-enabled MDK mobile applications published to the same Mobile Services service instance are...
https://asset-manager-forms-dev.cf.us01.hana.ondemand.com
https://asset-manager-forms-qa.cf.us01.hana.ondemand.com
https://asset-manager-forms-prod.cf.us01.hana.ondemand.com
...then the URL below (which utilizes the * wildcard character) will qualify all three URLs above...
https://*.cf.us01.hana.ondemand.com
The Server API URL assigned to an MDK mobile application published to a Mobile Services instance can be obtained as follows...
Note: As each Server API URL is added to the forms-xsuaa.xs-security.json file, the characters /login/callback must be appended to the URL.
Each modified Server API URL must be added as a "string" to the JSON array of the redirect-uris key in the project file forms-xsuaa.xs-security.json. This array comes pre-configured with one or more entries.
Note: The existing array entries pertain to the Mirata IdP service and must not be modified (unless directed to do so by Mirata support personnel).
The following image provides an example of the forms-xsuaa.xs-security.json file contents after adding the three Server API URL examples provided earlier (with /login/callback appended to each one)...
In the project file formsxsuaa.xssecurity.json, the tokenvalidity and refreshtokenvalidity keys of the oauth2-configuration object together dictate the time that will elapse before the user is required to reauthenticate with the mobile application. Both key values define a duration in seconds. The tokenvalidity key specifies the duration a newly issued, or newly refreshed, ID token remains valid. The refreshtokenvalidity key specifies the duration (starting from token issuance) that an expired ID token may be refreshed (i.e.– renewed) without requiring the user to reenter login credentials. When the ID token expires, and the refresh token’s validity period has also expired, the mobile application user will be required to reenter username and password credentials upon performing the first interaction with the MDK mobile application that requires a corresponding action be performed by BTP Mobile Services.
Note that the tokenvalidity key’s value must define a duration that is longer than the time it takes the Mirata Forms-enabled MDK mobile application to complete any one of its data synchronization (or “sync”) sessions.
The Mirata FOIL software directory contains a file with an installation script that executes Cloud Foundry (CF) CLI commands to build the following components and deploy them to the designated SAP BTP subaccount space…
Perform the following steps to execute the FOIL installation command script:
- Open an application that provides a command line interface to your computer’s operating system (e.g.- Terminal on macOS or cmd.exe on Windows)
- Make the Mirata FOIL software directory the current working directory (i.e. - use the cd command)
- Execute the CF CLI command cf login
- The first time this command is executed, you will be prompted to enter an API Endpoint
- This value can be obtained from the Overview page of the target BTP subaccount
- To switch between multiple BTP API endpoints, the target API endpoint URL can also be specified using -a command line option to the cf login command
- If you are not prompted to specify an API Endpoint, the previous API endpoint used will be displayed. If the displayed endpoint is not what is required, terminate the cf command’s execution (typically by using CTRL+C) and re-execute the cf login command using the -a command line option.
- When prompted, enter the email address and password that provides administrator-level access to the target SAP BTP account
- Select the target BTP subaccount from the list provided
- Select the target BTP space from the list provided
- Note that you will be prompted to select a space only if the specified subaccount has more than one space defined.
- Execute the appropriate installation command script file...
- install.cmd (for the Microsoft Windows operating system)
- ./install.sh (for the macOS and Linux operating systems)
Authenticated access to the selected BTP subaccount space via the CF CLI will remain valid for a 24-hour period, during which time execution of the cf login command will not be required prior to executing additional CF CLI commands. However, if you need to access a different BTP API endpoint, subaccount and/or space within this period, the CF CLI cf login command must be executed again using the -a command line option.
Once the FOIL application has been configured and installed in your SAP BTP subaccount space, a "trust relationship" must be established between the Mirata identity provider (IdP) and the FOIL XSUAA service (and by extension, to the default IdP configured in the BTP subaccount). To establish this trust relationship, configuration data from the FOIL XSUAA service instance must be obtained and provided to Mirata Support as follows:
- Navigate to the BTP subaccount space that hosts the FOIL application
- Expand the Services (vertical) tab
- Select the Instances (vertical) tab
- In the Service Instances table row for the forms-xsuaa instance, select the 1 binding; 1 key hyperlink in the Credentials column
- In the resulting Credentials window, ensure that the Form (horizontal) tab is selected
- Copy and temporarily record the values of the following fields...
- clientid
- clientsecret
- url
- Securely communicate this FOIL XSUAA configuration data to Mirata Support.
Every Mobile Destination definition requires an endpoint URL. For FOIL, this URL is the Application Route assigned by BTP, which is obtained as follows:
To add a Mirata Mobile Destination to a Mirata Forms-enabled MDK mobile application hosted by BTP Mobile Services, perform the following steps:
Each instance of a Mirata Forms-enabled MDK mobile application published to Mobile Services must be configured to use the XSUAA service instance installed with FOIL, as follows:
Note: The MDK mobile application used for to perform this connectivity test does not need to be a Mirata Forms-enabled mobile application. The Mirata Mobile Destination may be temporarily added to any functional MDK mobile application instance for the purpose of performing the test outlined in the section below.
Note: Data may or may not be returned for the other entries of the Entity Set dropdown field based on the data that currently exists in the Mirata environment
When modifications are made to the forms-xsuaa.xs-security.json configuration file, the FOIL XSUAA service can be updated accordingly by executing the following CF CLI command…
cf update-service forms-xsuaa -c forms-xsuaa.xs-security.json
The command above assumes that the formsxsuaa.xssecurity.json XSUAA configuration file exists in the current working directory. If this is not the case, either a relative path, or the fully qualified path, to the forms-xsuaa.xs-security.json configuration file must be specified.
If your organization has multiple Mirata environments (e.g.- development, quality assurance and production), each Mirata environment will have a unique API endpoint. The FOIL application utilizes a BTP Destination Service instance (named forms-destination) to define and manage the connection criteria of each Mirata API endpoint. A destination definition for each existing Mirata environment will be established when FOIL is installed.
Individual destination definitions can be maintained using the BTP web-based user interface, as follows:
To delete an existing destination...
- Select the delete (i.e.- the trash) icon in the Actions column of the destination row to be deleted
To edit an existing destination...
- Select the edit (i.e.- the pencil) icon in the Actions column of the destination row to be edited
- A group of fields appears immediately below the list of existing destinations that allows each attribute of the selected destination to be edited as required
- Select the Save button to save any modifications, or select the Cancel button to discard all modifications
To add a new destination...
- Select the New Destination hyperlink immediately above the list of existing destinations
- A group of fields appears immediately below the list of existing destinations that allows each attribute of the new destination to be entered
- Select the Save button to save any modifications, or select the Cancel button to discard all modifications
To add a new destination by copying an existing destination...
- Select the clone icon in Actions column of the existing row to be copied
- Note the clone icon appears as two sheets of paper overlayed with a right-pointing arrow
- A group of fields appears immediately below the list of existing destinations that are populated with the values from the existing destination record being cloned
- Note the Name field value will have _CLONING appended to the original value
- Edit the value of each attribute as required
- Select the Save button to save any modifications, or select the Cancel button to discard all modifications
The specific Destination Service definition that FOIL utilizes to connect to a Mirata API endpoint is specified using a User-Provided Variable, the value of which is managed as follows:
Updates to the FOIL application will be periodically issued by Mirata. Neither the FOIL XSUAA service nor the FOIL Destination service will be modified by applying a FOIL update.
The FOIL update software is provided in a Zip archive file (foil.zip). Expand this archive file into an empty file system directory.
Note: In the following section, this directory is referred to as the “Mirata FOIL software directory”
The directory the FOIL update archive was expanded into contains a file with an update script that executes Cloud Foundry (CF) CLI commands to build and deploy the updated FOIL application to the designated SAP BTP subaccount space. Perform the following steps to execute the FOIL update command script:
- Open an application that provides a command line interface to your computer’s operating system (e.g.- Terminal on macOS or cmd.exe on Windows)
- Make the Mirata FOIL software directory the current working directory (i.e. - use the cd command)
- Execute the CF CLI command cf login
- The first time you execute this command, you will be prompted to specify an API Endpoint
- This value can be obtained from the Overview page of the target BTP subaccount
- To switch between multiple BTP API endpoints, the target endpoint URL can also be specified using -a command line option to the cf login command
- If you are not prompted to specify an API Endpoint, the previous API endpoint used will be displayed. If the displayed endpoint is not what is required, terminate the cf command’s execution (typically by using CTRL+C) and re-execute the cf login command using the -a command line option.
- When prompted, enter the email address and password that provides administrator-level access to the target SAP BTP account
- Select the target BTP subaccount from the list provided
- Select the target BTP space from the list provided
- Note that you will be prompted to select a space only if the specified subaccount has more than one space defined.
- Execute the appropriate installation command script file...
- update.cmd (for the Microsoft Windows operating system)
- ./update.sh (for the macOS and Linux operating systems)