Skip to Content
0

How to connect sapui5 app with destination in CloudFoundry?

Mar 02 at 09:32 AM

224

avatar image

Hello,

I have a question about the connection between UI5 app and destination in CF.

In Neo environment I just create a destination and write the description in neo-app file, but how can I connect the app to the destination in CF?

Thank you in advance.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Ivan Mirisola
Mar 19 at 06:05 PM
0

Hi Tatiana,

Another way is to create an "User Provided Services" and call it as variable in your code. Once you assign this service as required to your application, CF will create a VCAP_SERVICES for it and will append this UPS. So the environment variables will be present at runtime.

Please review this answer on the topic.

Regards,
Ivan

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hello Ivan,

Can you please provide example of it? I tried to implement this, but app still can't see the destination.

0
Tatiana Rastorgueva

Hi Tatiana,

You would define a destination as a user provided service (UPS) and bind it as a requires of the html5 module.

Please take a look at this mta.yaml for an example.

Look at the html5 module's require statement (module named web in the above example):

requires:
.....
- name: EXTERNAL_UI5
  properties:
  ui5liburl: ~{url}

In this example the UPS is EXTERNAL_UI5 and it can be created this way. Once created and referenced as a required service of my html5 module, you can reference it as a variable on html5 code like this:

<script id="sap-ui-bootstrap" src="{{{ui5liburl}}}/resources/sap-ui-core.js"
  data-sap-ui-libs="sap.m"
  data-sap-ui-theme="sap_belize">
</script>

Here is another way in which you could define it. Instead of creating a UPS, you could define it directly on your mta:

- name: EXTERNAL_UI5
  type: org.cloudfoundry.user-provided-service
  parameters:
    service-name: EXTERNAL_UI5
    url: https://sapui5.hana.ondemand.com
  properties:
    ext-ui5-service-name: ${service-name}
    url: ${url}

And how the same is referred in the html5 module:

requires:
  - name: EXTERNAL_UI5
  properties:
  ui5liburl: ~{url}

Either way, it can be referred to in the same way on your html5.

Hope this helps,

Ivan

1
Richard Zhao
Mar 05 at 05:45 AM
0

Hello, Tatiana Rastorgueva. Could you check the post below, Please?

Destination Configuration

Unlike SAP Cloud Platform Neo, the Cloud Foundry environment does not offer a Destination API that application developers may use directly to connect to a resource over the web. But this limitation can be easily overcome through User-Provided Environment Variables and consuming them in your application.

This is how it works on the Cloud Foundry environment.

  • In your SAP Cloud Platform Cockpit, access the application.
  • Define a new “User-Defined Variable”. An example could be: key = “ServiceDestination”. Value = [{name: “ServiceDestination”, url: “https://hostname.domain.com”, username: “Username”, password: “LoginPassword”}].
  • In your application, use this variable to call the respective service.
Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hello,

COuld you please eleborate , how to use the variable to call the service ?

0
Yuvaraj Ramamurthy
Mar 20 at 03:26 PM
0

Hello Tatiana,

The CF counterpart of neo-app.json to manage routes is the xs-app.json. You should also include the Application router (Approuter in short) part of your UI5 application as a separate module to take care of login process and routing. Finally, you should define the destinations either part of your manifest.yaml or mtad.yaml(in case of MTA deployments) under env section.

Refer to this link for more details.

Cheers!

Share
10 |10000 characters needed characters left characters exceeded