Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
laszlo_kajan2
Active Participant

tl;dr


Update of 17-June-2020:

With a CAPM app, as long as your destination is named only with characters matching [a-z0-9-], standard destinations (see Liat's comment below) will work using the App Studio proxy at 127.0.0.1:8887. Use the following "destinations" definition in your .env1 file:



destinations=[{"name":"<name-of-destination>","proxyHost":"http://127.0.0.1","proxyPort":"8887","url":"http://<name-of-destination>.dest"}]

Note: this solution will not use, and will work without, the destination and connectivity service your deployed app is bound to.


The problem ("dial tcp: lookup dest_name.dest on 100.64.0.10:53: no such host") seems to be a lowercase transliteration of the destination name - e.g. from 'MY_DEST' to 'my_dest' - before the HTTP request is constructed, which causes the proxy to fail to find a matching destination.







At the moment (02-June-2020), when running a CAPM (Node.js) application in a 'SAP Cloud Business Application' dev space, it seems impossible to reach, from the Business Application Studio (BAS), an on-premise OData service that is exposed to the SCP via the cloud connector. The solution offered here is to use 'cf ssh' to tunnel traffic that is destined to the connectivity proxy.

Do this to reach an on-premise OData service via the cloud connector, from the Business Application Studio:

  1. Copy your deployed service app's 'VCAP_SERVICES' to 'default-env.json' at the root of your CAPM application.

    • There should be sections for 'connectivity', 'destination' and 'xsuaa' in 'VCAP_SERVICES'.



  2. Set, in the top 'default-env.json' file, 'connectivity'.'credentials':

    1. "onpremise_proxy_host": "127.0.0.1".



  3. Authorize ssh in your CF space, authorize ssh to '-srv' app, restart '-srv' app:

    1. In BAS terminal:
      cf allow-space-ssh <spacename> && cf enable-ssh <app-srv> && cf restart <app-srv>



  4. Open SSH tunnel to 'connectivityproxy.internal.cf.eu10.hana.ondemand.com':

    1. In BAS terminal:
      cf ssh <app-srv> -N -T -L 20003:connectivityproxy.internal.cf.eu10.hana.ondemand.com:20003



  5. Launch application router app '-app', and service app '-srv':

    1. In BAS terminal:

      (cd app && node node_modules/@sap/approuter/approuter.js)


    2. In another BAS terminal:
      cds watch




Goal


As presented in 'Building Applications with SAP Cloud Application Programming Model' Week 4 Unit 2: 'Connecting to R..., the CAPM makes it easy to connect to an on-premise OData service. While this works readily when the multi-target application (MTA) is deployed, when the app is run in the Business Application Studio (BAS) during development, with bindings (i.e. 'VCAP_SERVICES') copied from the deployed service app, the OData service is not reached (as of 02-June-2020).

Solution


The reason for this is that the connectivity proxy host 'connectivityproxy.internal.cf.eu10.hana.ondemand.com' used by the deployed application (configured in the 'connectivity' section of VCAP_SERVICES), is not reachable from the Business Application Studio.

A deployed service app - e.g. 'capire-bookshop-srv' - reaches the back-end OData like this:


In order to make the connectivity proxy reachable from the BAS during development, an ssh tunnel can be used, along with a modification of the 'onpremise_proxy_host' in the environment defined in 'default-env.json'. That leads to this:


Perform the following steps:

  1. Make sure you have copied your deployed service app's 'VCAP_SERVICES' environment to 'default-env.json' at the root of your CAPM application.

    • There should be sections for 'connectivity', 'destination' and 'xsuaa' in 'VCAP_SERVICES'.



  2. Set, in the top 'default-env.json' file, 'connectivity'.'credentials':

    1. "onpremise_proxy_host": "127.0.0.1".



  3. Authorize ssh:

    1. In your CF space:

      1. cf allow-space-ssh <spacename>



    2. For service app:

      1. cf enable-ssh <app-srv>



    3. Restart service app with ssh enabled:

      1. cf restart <app-srv>





  4. Open SSH tunnel to 'connectivityproxy.internal.cf.eu10.hana.ondemand.com':

    1. In BAS terminal:
      cf ssh <app-srv> -N -T -L 20003:connectivityproxy.internal.cf.eu10.hana.ondemand.com:20003



  5. Launch application router app '-app', and service app '-srv':

    1. In BAS terminal:

      (cd app && node node_modules/@sap/approuter/approuter.js)


    2. In another BAS terminal:
      cds watch




The following launch configuration can be used to debug the service application in the BAS:
{
"name": "Run bookshop",
"request": "launch",
"type": "node",
"runtimeExecutable": "npx",
"runtimeArgs": ["--node-arg"],
"args": ["--", "cds", "run"],
"skipFiles": ["<node_internals>/**"]
}

The service application now reaches the on-premise OData service.

Summary


In this blog I showed you how to overcome the difficulty of reaching an on-premise OData service from the Business Application Studio. The solution is to tunnel this OData traffic through an ssh tunnel to the internal connectivity proxy.

Author and motivation


Laszlo Kajan is a full stack Fiori/SAPUI5 expert, present on the SAPUI5 field since 2015, diversifying into the area of SCP development.

The motivation behind this blog post is to provide a solution for developing with on-premise OData services in the Business Application Studio.

Further reading


10 Comments
Labels in this area