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.