Quantcast
Channel: SCN : Popular Discussions - SAP HANA Cloud Platform Developer Center
Viewing all articles
Browse latest Browse all 1318

Cloud Platform HANA XS - Using XS Destinations

$
0
0

Hi, I am relatively new to HCP and using HANA XS, I want to establish an outside connection using http destinations.

 

I found this guide: https://help.hana.ondemand.com/help/frameset.htm?06ca24043b0f4eb78cf39c6bc1d8a8dc.html

 

I implemented it and granted my user the Basic privileges, as described in the tutorial.

 

But the example is not working. I get the following error while running my app: User is not authorized to use destination (package: myhana.hello, name: google)

 

In this example myhana is my HANA XS instance, hello ist the application package. The destination file is in the same folder as my outsideconnection.xsjs

 

My Code is:

 

 

var destination_package = "myhana.hello";

var destination_name = "google";

 

 

try {

       var dest = $.net.http.readDestination(destination_package, destination_name);

       var client = new $.net.http.Client();

       var req = new $.web.WebRequest($.net.http.GET, "?origins=Frankfurt&destinations=Cologne&mode=driving&language=en-US&sensor=false");

       client.request(req, dest);

       var response = client.getResponse(); 

      

    $.response.contentType = "application/json";

       $.response.setBody(response.body.asString());

       $.response.status = $.net.http.OK;

} catch (e) {

       $.response.contentType = "text/plain";

       $.response.setBody(e.message);

}


Viewing all articles
Browse latest Browse all 1318

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>