Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

Problem --> 8.4.1 Tutorial: Use the XSJS Outbound API

$
0
0

I'm trying to establish an outbound connectivity with wunderground in SAP HANA. For this reason, I tryied to do the tutorial from the developer guide. But I have issues with rebuilding the example of the tutorial.

On page 458 in the developer guide there is the sample code for the so called "sapStock.xsjs". If I try to commit this class, I get a syntax error.

 

 

The code of the class is:

 

var stock = $.request.parameters.get("stock");

var amount = $.request.parameters.get("amount");

var dest = $.net.http.readDestination("testApp", "yahoo");

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

var req = new $.web.WebRequest($.net.http.GET, "&s=" + stock);

client.request(req, dest);

var response = client.getResponse();

var co = [], he = [];

for(var c in response.cookies) {

co.push(response.cookies[c]);

}

for(var c in response.headers) {

he.push(response.headers[c]);

}

var body = undefined;

if(response.body)

var body = response.body.asString();

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

var res = parseInt(response.body.asString()) * amount;

$.response.setBody(amount + " of your " + stock + " are worth: " + res);

 

 

Following error message appears:

 

Move 'var' declarations to the top of the function.    sapStock.xsjs    /Outboundtest/05    line 9    JSLint Problem

 

 

Can anybody help me? Attached there is a screenshot of my problem.


Thank you for your help.


Viewing all articles
Browse latest Browse all 6412

Trending Articles



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