Developing multitenant applications on SAP CP – Cloud Connectivity Services
Previous blog talks about on-premise Connectivity services where Emily and Stephen have setup connectivity between the on premise services running within their landscape to the applications running in the respective accounts.
This blog is about cloud connectivity services to be used in following steps
Let’s look at these steps in detail.
Step 1: Connect connectivity on the consumer account (to service running on SAP CP)
In consumer account, HTML5 application uses services for displaying plant and pollution datafrom Java application. Hence there is need to configure destination in the consumer account that points to subscribed Java application and this will be consumed by HTML5 application running in same consumer account.
Let’s understand how Emily will configure this destination that points to the subscribed pollution monitoring Java application running in ABC PetroCorp(Consumer) account.
|a) There is a destination file ‘pollution-monitoring-service-dest’ file that is available under the folder ‘Destinations-ABCPetroCorp’.|
b) Here, destination URL points to the subscribed pollutionmonitoring Java application if ABC PetroCorp(Consumer) account.
Since this destination to be consumed by HTML5 Application so “WebIDEEnabled” is “true” and “Authentication” is “AppToAppSSo”(Application to Application Single Sign on)
“URL” needs to be copied from your Java app subscription URL as mention in the next step.
The copied URL should be updated in the destination file mentioned above and the URL parameter should be uncommented (remove # in the file).
|c) Copy the ‘pollutionmonitoring’ Java application subscription URL from Application URLs section.|
|d) Navigate to ‘Destinations’ pane of your ABC PetroCorp(Consumer) account click on ‘Import Destination’.|
e) Select the file location of ‘pollution-monitoring-service-dest’ file.
The destination would be added in your account as shown in the screenshot click on ‘Save’
Let’s understand that how pollutionmonitoringui HTML5 application consume subscribed pollutionmonitoring Java application.
For this you need to import the pollutionmonitoringui into the SAP Web IDE workspace.
|a) Navigate to “Services” pane of ITeLo Consulting (Provider) account and search for “SAP Web IDE service” and click on it.|
|b) Click on “Open SAP Web IDE”.|
c) SAP Web IDE Editor opens in new Tab of the same browser.
d) Click on the “</>” Development pane.
|e) Import the pollutionmonitoringui using File->Import->From File System.|
|f) Choose the “pollutionmonitoringui.zip” file from the location mentioned in next step.
Import to “/pollutionmonitoringui” folder under Workspace. Select “Extract Archive” check Box.
|g) “pollutionmonitoringui.zip” file is defined under the folder “HTML5 Code”.|
h) Project “pollutionmonitoringui” imported into the SAP WEB IDE workspace and looks like this.
i) Open the neo-app.json file.
|j) The destination “pollution-monitoring-service-dest” is defined in the neo-app.json file and through this HTML5 code invokes “pollutionmonitoring” Java service||neo-app.json
Step 2: Configure connectivity on the provider account (to service running on the internet)
As outlined in the Application overview pollution monitoring application helps consumers to compare plant’s pollution data with city’s pollution data.
In the part4 of this blog series you have seen that plant’s pollution data for different consumers have been initialized but what’s about city’s pollution data? How do consumers access this data?
The answer is air quality service from OpenAQ which is open source and publically available over the internet. Pollution monitoring application can access this service using SAP CP destination.
Since this service will be commonly used by ABC PetorCorp and XYZ EnergyCorp so destination would be added into the ITeLo Consulting (Provider) account.Robert will perform the following step.
Configure connectivity from application running on provider account to cloud based services using SAP CP destination
|a) In the Java application, the destination “openaq–api–dest” has been configured in the web.xml file.||
b) This destination “openaq-api-dest” is being looked up in the “PollutionDataService” class.
Once the destination look up has been done, all calls from the Java code to the open air quality service are triggered via this destination.
ConnectivityConfiguration configuration = (ConnectivityConfiguration) ctx
// Get destination configuration for “destinationName”
DestinationConfiguration destConfiguration = configuration.getConfiguration(“openaq-api-dest”);
c) There is a destination file ‘openaq-api-dest’ file that is available under the folder ‘Destinations-Provider’.
This destination points to the open air quality service URL
This destination needs to be uploaded to the “ITeLo Consulting (Provider)” account as shown in the steps below.
|d) Navigate to “Java Application” pane of ITeLo Consulting (Provider) account and click on “pollutionmonitoring” Java application.|
|e) Navigate to “Destinations” pane of your pollutionmonitoring Java application and click on “Import Destination”.|
|f) Select the file location of “openaq-api-dest” file.|
|g) The destination would be added in your account as shown in the screenshot click on ‘Save’.|
Making secure connections to https services
Service is accessible over https, so you need to make secure connection. This can be achieved using keystore service from SAP CP. We have prepared key material as “jssecacerts.jks” and “cacerts.jks” files which Emily can reuse and upload in “ABC PetroCorp(Consumer)” account.
a) Using the neo console client, upload Keystores for OpenAQ ABC Petro Corp (Consumer) account.
neo upload-keystore –account <<ABC_PetroCorp_consumer_account_id>> –user <<your_user_id>> –location <<location of jssecacerts.jks>> –host <<your_landscape_host>>
neo upload-keystore –account <<ABC_PetroCorp_consumer_account_id>> –user <<your_user_id>> –location <<location of cacerts.jks>> –host <<your_landscape_host>>
|b) Files cacerts.jks and jssecacerts.jks are defined under the folder KeyStore Services|
Step 3. Test the Pollution Monitoring dashboard by login to HTML5 Application
Emily login to pollutionmonitoringui HTML5 Application by following instruction of Section 5 -Part 5 (Developing multi-tenant applications on SAP CP – Identity Management) of the blog series and test whether Pollution Monitoring dashboard
- displays plant and pollution data
- compare pollution(ozone) level by plant and city
- authorize users to display UI based upon their roles(all plants or single plant information)