Skip to Content
Author's profile photo Ashitha MS

Developing multi-tenant applications on HCP : On-premise Connectivity – Part 6

As outlined in the Application Overview, ABC PetroCorp & XYZ EnergyCorp have on –premise services running within their landscape that provide information about their plants – details like no. of workers at each plant, area of the plant etc. The pollution monitoring shows this information in the dashboard.

To achieve this, the on-premise services need to be exposed from their landscape and provided to the cloud application. This can be achieved using the HCP Connectivity service. Emily (IT admin for ABC PetroCorp) and Stephan (IT admin for XYZ EnergyCorp) will do this for their respective landscapes.

Let’s understand how Emily will set up the connectivity between the on-premise services running within ABC PetroCorp network and the application running in the ABC PetroCorp (Consumer) account. Refer to the section highlighted in red below.

Emily will perform the following steps.
Step1: Expose on-premise services securely using SAP Cloud Connector

Step2: Configure connectivity between exposed on-premise services and the cloud application using HCP destinations

 

Let’s look at these steps in detail.

Step1: Expose on-premise services securely using SAP Cloud Connector

Note:To make it easy to execute the tutorial, we will simulate the on-premise setup by running a service locally on a Tomcat server installed on our machine. And then use the SAP Cloud Connector installed on our machine to securely expose this service to the cloud.
In practice, Emily will work with on-premise services running within the company landscape.

Section 1: Simulate on-premise setup by running a mock service on your machine

A mock service is available in the Git repository. In this step, you will import, deploy and run this mock service on a local Java Web Tomcat 8 server.

Import project containing mock service into Eclipse

Step Screenshot

a) The mock service has been uploaded as a WAR file under On-Premise Services folder (see screenshot).

 

 

b) Using the File>Import option in Eclipse, import the WAR into the workspace.

In the WAR Import dialog, provide  the following info:

WAR file: File location of the ABC PetroCorp.war file

Target runtime: Java Web Tomcat 8

c) After a successful import, in the Project Explorer view, the project structure should look like this.

 

 

Deploy and run the mock service on local Java Web Tomcat 8 server

Step Screenshot

a) Deploy imported on- premise service on to local server (Java Web Tomcat 8).

In the Project Explorer, right click on ABCPetroCorp node. Select Run As>Run on Server.

 

In the Run on Server dialog, choose “Manually define a new server”.

 

Enter the following details:

Server’s host name: localhost

Server name: mock_on_premise_services

Click on Finish.

 

 

 

b)Once the deployment has been done, you should see the following structure under Servers view.
c) This mock service can be accessed at the URL
http://localhost:8080/ABCPetroCorp/Note: It could be possible that your server does not run on port 8080. In that case please check the port number of your server and execute http://localhost:<your port number>/ABCPetroCorp.

This would return:

 

{“plants”:[[{“numberOfWorkers”:”7543″,”country”:”CANADA”,”
crudeOilCapacity”:”7857 gallons”,”plantId”:”101″,”location”:”New BrunsWick”,”plantArea”:”1212 Sq feet”,”plantName”:”LPG Production”},{“numberOfWorkers”:”10000″,”country”:”CANADA”,”crudeOilCapacity”:”20000 gallons”,”plantId”:”102″,”location”:”Alberta”,”plantArea”:”5252 Sq feet”,”plantName”:”Oilfield Production”},{“numberOfWorkers”:”8000″,”country”:”CANADA”,”crudeOilCapacity”:”18000 gallons”,”plantId”:”103″,”location”:”British Columbia”,”plantArea”:”4846 Sq feet”,”plantName”:”Gas Processing and Compression Plant”}]],”companyName”:[“ABC PetroCorp, CANADA”]}

 

Section 2: Expose the mock service using SAP Cloud Connector

The ABC Petro Corp mock service can be exposed to the application running on HCP in a secure and easy way using SAP Cloud Connector.

For executing this tutorial easily, the SAP Cloud Connector will be installed on your local machine.

In the actual scenario, Emily will install and configure the Cloud Connector within the company landscape.

Pre-requisites:

  1. You have SAP HANA Cloud Connector installed
  2. You have performed the initial configuration on SAP Cloud Connector

Configuring Access Control for consumer account

The internal on-premise system will be exposed using a virtual system. This virtual system then will be used in the HTTP destination configuration in SAP HANA Cloud Platform in the next step (Step 2). More info on configure access control can be found here.

Step Screenshot
a) Log in to the SAP Cloud connector
with URL https://<hostname>:<port>
<hostname> would be localhost if
installed on local machine.
<port> is the Cloud connector port
specified during installation
(default port is 8443).

 

 

 

b) Add the HCP account to
which you want to expose
the on-premise mock services.
Here we are
connecting to the
ABC PetroCorp (Consumer)
Navigate to the Connector tab and
click on Add Account

c) Enter details of the
ABC PetroCorp (Consumer)
account and click Save.
 
d) Once added, it will be listed in
the Account Dashboard.

 

e) Next step is to configure
access control. There has to be a
mapping created between the
local system and the virtual system.

This has been
made available as
access_control_<<consumer name>>.zip
file 
under the SAPCloudConnector
folder.

You can import this file to configure
access control in the SAP Cloud
connector as described in the
upcoming steps.

f) Navigate to ‘Cloud To On-Premise’
section and under the
ABC PetroCorp Account.

 

g) Check that the ‘Account’
dropdown shows the correct
account and go to ‘Access Control’ tab.

Click on Import corresponding to the
‘Mapping Virtual to Internal System’
section as shown in the screenshot.

h) This opens ‘Import System Mappings’
dialog.
Select ‘From File’ radio button and
choose Browse.

 

 

i) Select the location of the ‘access_control_ABCPetroCorp.zip’
file and click on Import.

 

j) This will import the access control
setting on to your SAP Cloud connector.
Note:
The access_control_ABCPetroCorp.zip
file assumes port number 8080 for the
on-premise service.
In case your mock service runs
on different port, then Edit the mapping with
the correct port number.
k) Check that the access control has been
configured correctly.

 

l) In the HCP cloud cockpit for the
ABC PetroCorp (Consumer) account,
navigate to the
Connectivity>Cloud Connectors tab.
You would see the status of the SAP Cloud
Connector as shown in the screenshot.

 

With this step, the mock on-premise services have been exposed to the ABC PetroCorp (Consumer) account.

 

Step2: Configure connectivity between exposed on-premise services and the cloud application using HCP destinations

In this step, the Java cloud application on HCP will connect to the exposed mock on-premise services through HTTP destinations in HCP.

Configure destinations from HCP

Step Screenshot
a) There is a destination file ‘onprem-plandata-dest’ file that is available under the folder ‘Destinations-ABCPetroCorp’.

b) This destination points to the mock on-premise service URL.

 

This destination needs to be uploaded to the ABC PetroCorp (Consumer) account as shown in the steps below.

c)  Navigate to ‘Subscriptions’ pane of ABC PetroCorp (Consumer) account and click on ‘pollutionmonitoring’ Java application subscription.
d) Navigate to ‘Destinations’ pane of your subscribed pollutionmonitoring Java application and click on ‘Import Destination’.

 

e) Select the file location of ‘onprem-plandata-dest’ file

 

 

f) The destination would be added in your account as shown in the screenshot click on ‘Save’.

 

 

Access the on-premise service from the cloud Java application
If the on-premise connectivity setup is working fine, then the on-premise service would be accessible via the pollutionmonitoring Java application.

Step Screenshot

a) In the Java application, the destination “onprem-plantdata-dest” has been configured in the web.xml file.

 

 

b) This destination “onprem-plantdata-dest” is being looked up in the PlantDataService.java class.
Once the destination look up has been done, all calls from the Java code to the mock service are triggered via this destination.

c) We will test this service call from the Java application.
In the ABC PetroCorp (Consumer) account, navigate to the Subscriptions tab and click on the Java subscription pollutionmonitoring.

 

d) From the Overview section, copy the pollutionmonitoring Java Application URL.

 

e) Append ‘/api/v1/plantdata’ to the the URL and run the service call in a browser.

The URL will look like:

https://pollutionmonitoring<provider account id>-<consumer account id>.<<landscape_host>>/pollutionmonitoring/api/v1/plantdata

 

The plant details returned from the mock on-premise services (invoked by the Java application) are shown in the browser.

 

That’s it! The pollution monitoring application in HCP is connected to the on-premise services running within the ABC PetroCorp network. The important point to note here is that the connectivty was established at the subscription(tenant) level.

Remember that Stephen has to perform similar steps to configure connectivity to services from XYZ Energy Corp.

In the next blog, we will look at connecting the HCP application to services running on the Internet.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.