cancel
Showing results for 
Search instead for 
Did you mean: 

Purpose of destination service lite in Cloud Foundry and how to use this in mta.yaml

Shilpakrishna
Participant
0 Kudos

Hi All,

What is the purpose of destination service lite(CF->Services->Service Market Place) in Cloud Foundry, where we create destination Instance and then we create multiple destinations inside the Destination instance? (not the one at sub account level under Connectivity)

If I have created 2 destinations(for ex: dest_1 & dest_2) inside a destination instance(dest_Employee - this is auto generated in mta.yaml when a html5 module is added to MTA) then, how do I reference a specific destination "dest_1" in my HTML5 module in mta.yaml?

Thanks

Shilpa

Accepted Solutions (1)

Accepted Solutions (1)

mariusobert
Developer Advocate
Developer Advocate

Hi Shilpa,

sorry for the late response, I hope this answer is still helpful:

First, the consumption works the same for both types of definitions, the ones on a subaccount level as well as for the ones on the service instance level. (see docu for more details)

In order to consume a destination (here named 'Northwind3') you need to modify the following files:

1. Add the data source, destination service and the binding in the mta.yml file :

   requires:
   ...
    - name: dest_service

...
resources:
 - name: dest_service
   parameters:
      service-plan: lite
      service: destination
   type: org.cloudfoundry.managed-service

2. Define the model in the manifest.json file

"dataSources": {
  "northwind.svc": {
    "uri": "/v2/northwind/northwind.svc/",
    "type": "OData",
    "settings": {
	"odataVersion": "2.0",
	"localUri": "localService/northwind.svc/metadata.xml"
    }
  }
}
...

"models": { 
"": {
  "uri": "/V2/Northwind/Northwind.svc/",
  "type": "sap.ui.model.odata.v2.ODataModel",
  "settings": {
    "defaultOperationMode": "Server",
    "defaultBindingMode": "OneWay",
    "defaultCountMode": "Request"
  },
  "dataSource": "Northwind.svc",
  "preload": true
},

3. Add the route to the destination in the file xs-app.json:

"routes": [{
  "source": "^/V2/(.*)",
  "destination": "Northwind3"
},

4. Use it in the SAPUI5 via data binding

Edit: I've written a blog post about this topic, I hope it provides more insight 🙂

Regards,

Marius

cmos
Participant
0 Kudos

Hi Marius,

I am currently facing a similar problem and have one additional question:

Where did you define the destination "Northwind3" (e.g. the reference to the url services.odata.org)? Do you have to do that manually in the dashboard of the destination service (dest_service) after it was created by deploying the mtar or is there a way to define the necessary parameters directly within the mta.yaml?

Although, this topic is already marked as solved, maybe you can post some additional information of how to define destinations automatically.

Thanks in advance.

Regards

Christian

mariusobert
Developer Advocate
Developer Advocate
0 Kudos

Hi Christian,

You are right, you need to define the destination in the SAP Cloud Platform Cockpit. You can do this in two places (when we're talking about CF):

* on subaccount level

* on service instance level

Unfortantely you cannot provide those information in your MTA (since you want to de-couple this from you application).

I've also written a blog post about this topic (section "Using the destination-service in the backend" list item 1)

Regards,

Marius

cmos
Participant
0 Kudos

Hi Marius,

Thanks for the reply.

Does that mean, I don't know the name of the destination inside the programming (Java, Node.js, ...) of the mtar, because the user is more or less free to choose the name and content? So in the example above, the app is not working if the user chose a different name than "Northwind3" (e.g. a typo) for the destination?

As we are now talking about the CF stack in this case: we were able to create a destination via the MTA-file in the NEO environment before (a module of type com.sap.hcp.destination). Has this function been removed in the CF environment?

Regards.

Christian

mariusobert
Developer Advocate
Developer Advocate
0 Kudos

Hi Christian,

I'm not sure to whom you are referring when you say "user". Do you mean a developer or an application end user? The developer should know the proper name of the destination and end users shouldn't be the ones who select a destination or did I misunderstand you?

About the second question: As far as I know, this is currently not possible in CF. Maybe you can open another question thread here to see if someone can confirm this.

Regards,

Marius

cmos
Participant
0 Kudos

Hi Marius,

Thanks again for the reply.

Of course the developer defines somewhere in the code the name of the destination, the software should be looking for. Especially, if multiple destinations are available, this name has to be unique.

Nevertheless, the developer defines the name of the destination. In the CF scenario, the developer provides documentation to an account administrator, who deploys the application. After running through the automated installation process, a destination serivce instance is created without any destination definitions. The administrator has to create them manually according to the documentation.

If the naming in this manual process step is not entered in the same way, the developer has defined it, running the application most likely will fail.

In the "old NEO" days, we were able to define most of the parameters required for a destination and use mtaext-files to add user specific parameters. That feature is what we are currently looking for.

Regards.

Christian

Answers (0)