SAP Mobile Services License¶
OData services built by the mobile back-end tools will usually by accessed by mobile clients using SAP Mobile Services as an intermediary.
-
An OData service deployed for development or testing does not require a SAP Mobile Services license.
-
An OData service deployed into SAP Mobile Platform (for development, testing or production) does not require a SAP Mobile Services license.
-
Otherwise production deployment of the generated service (into SAP Business Technology Platform Cloud Foundry or on-premise) requires a SAP Mobile Services license.
When an OData service starts, and subsequently once per day, it will perform an online license check with the associated SAP Mobile Services instance.
If the license check fails every day for 20 successive days, the OData service will automatically shut down. It can be manually restarted and will be able to run for another 20 days before shutting down again (and this can be repeated indefinitely), but that would be inconvenient and inappropriate in a production environment.
Bidirectional connectivity needs to be established between the deployed OData service and the SAP Mobile Services instance to enable the license check to succeed.
Note
Although a license is not required for local development or testing of the deployed OData service, performing the Mobile Destination setup and Cloud Connector Setup for local deployments can be useful to test and become familiar with the license check mechanism in preparation for later production deployment.
Mobile Destination Setup for License Checks¶
The OData service should be deployed before setting up a Mobile Destination for License Checks.
Firstly, use the SAP Mobile Services Cockpit Settings > Security
section, to configure and test trust between SAP Mobile Services and your SAP Business Technology Platform Cloud Foundry sub-account.
Subsequently, the Mobile Destination can be set up using one of the following 3 methods in a SAP Business Technology Platform Cloud Foundry environment.
Note
In the following instructions, <app-name>
refers to the -application
name
that was selected for service generation.
Using the setup-mbt-license
Task in tasks.json
¶
This is the fastest setup method.
The MBT: Create tasks.json file command should have created
a Visual Studio Code Task labeled setup-mbt-license
which can setup
the Mobile Destination for License Checks.
For local or on-premise deployments, edit the tasks.json
file and add the -cc
option to the setup-mbt-license
task.
Use Terminal > Run Task > setup-mbt-license
in Visual Studio Code or SAP Business Application Studio.
In certain situations this task may request some additional manual steps to be taken.
See Cloud Connector Setup for License Checks for further instructions relating to local or on-premise deployments.
Using the btp-cf-setup
Command Line Tool¶
This setup describes the command-line tool that is used by the setup-mbt-license
task.
The btp-cf-setup
command line tool is delivered as Windows batch file btp-cf-setup.bat
and as Mac/Linux shell script btp-cf-setup.sh
inside the resources\server-odata-sdk\bin
folder within the Visual Studio Code Extension.
-
Windows:
%USERPROFILE%\\.vscode\\extensions\\sapse.vsc-extension-mbt-*X.Y.Z*\\resources\\server-odata-sdk\\bin\\btp-cf-setup.bat
-
Mac/Linux:
$HOME/.vscode/extensions/sapse.vsc-extension-mbt-*X.Y.Z*/resources/server-odata-sdk/bin/btp-cf-setup.sh
-
SAP Business Application Studio (in a
Terminal
window): locate withfind /tmp/vscode-unpacked -name btp-cf-setup.sh -print
The minimal command-line tool parameters are the command mbt-license
, and an <app-name>
.
Mac/Linux shell example:
btp-cf-setup.sh mbt-license <app-name>
Windows Command Prompt example:
btp-cf-setup.bat mbt-license <app-name>
For local or on-premise deployments, add the -cc
option to the above command line.
In certain situations this tool may request some additional manual steps to be taken.
See Cloud Connector Setup for License Checks for further instructions relating to local or on-premise deployments.
Using SAP Business Technology Platform Cockpit, SAP Mobile Services Cockpit and Cloud Foundry Tools¶
In case the above task and/or tool do not achieve the required configuration, some or all of the following manual steps may be required.
-
Login to the SAP Mobile Services Cockpit.
- If the OData service was deployed to Cloud Foundry (rather than locally or on-premise),
then please use the same Cloud Foundry same
org
andspace
when logging into the SAP Mobile Services cockpit.
- If the OData service was deployed to Cloud Foundry (rather than locally or on-premise),
then please use the same Cloud Foundry same
-
Use the SAP Mobile Services Cockpit to create a Native/Hybrid mobile application named
mbt_license
.-
Once it is created, click on the
Security
tab and click on theEdit
(pencil) icon to the right ofApplication Settings
. -
Change the
Security Configuration
toAPI Key Only
and clickOK
. -
Scroll down the page to see the
API Key
in UUID form, e.g.123e4567-e89b-12d3-a456-426614174000
. Make a note of the API Key. The following instructions will designate the API Key as the<license-api-key>
.
-
-
Click on the
Native/Hybrid
option in the left navigation area to show the list of Native/Hybrid mobile applications. Click on thembt_license
application. Click on theAPIs
tab. Scroll down the page and make a note of the URL for theServer
API. The following instructions will designate this URL as the<server-api-url>
. -
Click on the
Native/Hybrid
option in the left navigation area to show the list of Native/Hybrid mobile applications. Click on thembt_license
application. -
In the
Assigned Features
area, click onMobile Connectivity
. Click on theCreate
icon to create a new Mobile Destination with the name<app-name>
.-
For the
Rewrite Mode
, chooseNo Rewriting
. -
For a service that was deployed as a Cloud Foundry app, then for the
URL
enterhttps://<route>
, where<route>
is the Cloud Foundry route for the deployed app. Use the Cloud Foundry command-line toolcf app <app-name>
if needed to identify the route. -
For a service that was deployed locally (or on-premise), then enable the
Use Cloud Connector
checkbox and for theURL
enterhttp://<virtual-host>:<virtual-port>
, and refer to Cloud Connector Setup for License Checks.
-
-
Create an HTTP destination for the OData service to use in communication with SAP Mobile Services.
-
For a service that was deployed as a Cloud Foundry app, see SAP Business Technology Platform Connectivity.
-
Use the SAP Business Technology Platform Cockpit to create an instance of the
destination
service (if you haven't already created an instance).- This can also be done using the cf create-service command,
e.g.
cf create-service destination lite my-destinations
.
- This can also be done using the cf create-service command,
e.g.
-
Use the SAP Business Technology Platform Cockpit to bind your
destination
service instance to your deployed Cloud Foundry app.- This can also be done using the cf bind-service command,
e.g.
cf bind-service <app-name> my-destinations
.
- This can also be done using the cf bind-service command,
e.g.
-
Use the Destinations Editor in the SAP Business Technology Platform Cockpit to create a destination named
mbt_license
.- For the
Type
, chooseHTTP
. - For the
URL
, enter the<server-api-url>
that you noted earlier. - For the
Proxy Type
, chooseInternet
. - For the
Authentication
, chooseBasicAuthentication
. - For the
User
, enterX-API-KEY
. - For the
Password
, enter the<license-api-key>
that you noted earlier.
- For the
-
Restart your deployed OData service, e.g. using the
cf restage <app-name>
command.
-
-
For a service that was deployed locally (or on-premise), assuming Apache TomEE or Tomcat, create a destination properties file
<tomee-home-directory>/conf/http/mbt_license.properties
.-
Enter the following properties in your local destination file:
url=<server-api-url>
(that you noted earlier)cf_org=<org-name>
(with your Cloud Foundryorg
name)cf_space=<space-name>
(with your Cloud Foundryspace
name)username=X-API-KEY
password=<license-api-key>
(that you noted earlier)
-
Restart your deployed OData service.
-
-
Cloud Connector Setup for License Checks¶
This section is only relevant for local or on-premise deployments of the generated OData service.
Local deployments for development and testing do not require a license, but setting up the Cloud Connector in such cases is a useful validation exercise in preparation for production deployment.
Once the Mobile destination Setup for License Checks has been completed,
there should exist in the SAP Mobile Services account a Mobile/Native application named mbt_license
, and a Mobile Destination named <app-name>
.
If the OData service was deployed locally (or on-premise), then the Mobile Destination should have the Use Cloud Connector
checkbox
enabled and should have a URL
of the form http://<virtual-host>:<virtual-port>
.
The recommended <virtual-host>
is the <app-name>
with all underscores ('_') replaced with hyphens ('-').
For example, if the <app-name>
is my_app
, then the <virtual-host>
should be my-app
.
The recommended <virtual-port>
is 80
.
Set up SAP Cloud Connector with the selected Virtual Host
name (e.g. my-app
) and Virtual Port
number (e.g. 80
)
and an Internal Host
name and Internal Port
number that match the local or on-premise host name and port number of the deployed OData service.