Skip to Content
Technical Articles
Author's profile photo Milton Chandradas

How to consume destinations in SAP Cloud Platform (Cloud Foundry)

Github repository:

To be published soon…

 

Introduction:

  • In this session, we will look at how to consume destinations in SAP Cloud Platform (Cloud Foundry environment)

 

Synopsis:

  • SAP is slowly moving away from the proprietary Neo environment towards the more open Cloud Foundry environment
  • The destinations in the Cloud Foundry environment can be created both at the sub account level and also at the space level in the form of a service instance
  • Consuming destinations is a major part of SAPUI5 applications since this can eliminate the CORS errors in browsers

 

Steps:

  • In this example, we will consume the destination created at the space level in the form of a service instance
  • We will use the yo easy-ui5 template wizard to create our project
  • We will look at how to consume a destination locally during the development process
  • We will also look at how to consume the destination in Cloud Foundry

 

YouTube link:

 

Conclusion:

  • This video should give you a clear idea on how to consume destinations in SAP Cloud Platform Cloud Foundry environment
  • In the next video, we will look at how we can get the logged in user in SAP Cloud Platform Cloud Foundry environment
  • If you have any questions or comments, please list them below and I will be happy to answer

 

Next post:

https://blogs.sap.com/2020/08/23/how-to-get-logged-in-user-in-sap-cloud-platform-cloud-foundry/

 

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Archana Shukla
      Archana Shukla

      Thank you for the blog. It would be great if you could also explain the difference between connectivity service and destination service and when to use what. That for me is most confusing.

      Author's profile photo Milton Chandradas
      Milton Chandradas
      Blog Post Author

      I created a new video that talks about the Connectivity Service and Destination Service in SAP Cloud Foundry...

      https://blogs.sap.com/2020/09/19/how-to-connect-applications-to-on-premise-system-cloud-foundry-environment/

       

      Author's profile photo Poojith MV
      Poojith MV

      Hi Milton,

      Thanks for the nice blog. I am currently working on a migration from the on-premise portal to the cloud portal and I am trying the below scenario.

      There are a couple of Portal Components (Abstract Portal Component) which are currently deployed and running on the on-premise portal as a plugin.

      I would like to consume the Portal component from the cloud portal. Please let me know how can I go about doing it with a destination?

      Regards,

      Poojith M V

      Author's profile photo Rauf Shaikh
      Rauf Shaikh

      Hi Milton Chandradas ,

      In your video it looks pretty simple, but still I am getting 404 error while using the destination, kind request to please help me here:

      ui5.yaml

      server:
        customMiddleware:
        -	name: ui5-middleware-cfdestination
        afterMiddleware: compression
        configuration:
          debug: true
          port: 1091
          xsappJson: ztestdest-approuter/xs-app.json
          destinations:
            -	name: "authentication_dest"
              url: "https://docmgmnt.authentication.eu10.hana.ondemand.com"

      my standalone approuter

      {
        "authenticationMethod": "none",
        "routes": [
          {
          	"source": "^/oauth/(.*)$",
          	"authenticationType": "none",
          	"destination":"authentication_dest",
          	"csrfProtection":"false"
          }
        ],
        "welcomeFile": "/nsztestdestmod"
      }

      my  UI controller where I using the destination

      var settings = {
                              "url": "/oauth/token?grant_type=client_credentials",
                              "method": "POST",
                              "headers": {
                                  "Content-Type": "application/x-www-form-urlencoded",
                                  "Authorization" : "Basic",
                                  "username" : "uaa:sb-a5d67be1-",
                                  "password" : "uaa:wdmF",
                                  "Access-Control-Allow-Origin" :"*"
                              }
                          };
      
                          $.ajax(settings).done(function (response) {
                              debugger;
                              console.log(response);
                          });

      after doing all these tasks I get HTTP 404 (strict-origin-when-cross-origin) for url https://workspaces-ws-gpkdc-app1.ap21.trial.applicationstudio.cloud.sap/oauth/token?grant_type=client_credentials

       

      Please guide further

      -Regards,

      Rauf