cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Hana XS app and outbound connection to http Webpage

Former Member
0 Kudos

Hello folks,

i just got into the development with SAP Hana XS trial instance and wanted to create my first app which should analyze a webpage and store the results in the SAP Hana database.

What i currently achieve is the outbound http connection just like in the examples given from SAP (with Google Maps API).

Now i wanted to download a webpage through SAP Hana XS and analyze its contents. Unfortunately i only receive the following error when trying to display just the contents of the fetched url:

"Error: Body.asString : unsupported charset specified in Content-Type header (""UTF-8"") "

Could you guys please give me hint what i should do to   :

     a) see if the XS app has actually downloaded the right page

     b) to receive the webpage internally as a string

Besides that i wanted to ask you if it is possible to Debug in the Web-IDE ? Do i have a console where i can log some variables?

I attached my XS app so that you can have a look at the code.


try {

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

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

       var req = new $.web.WebRequest($.net.http.GET, "/LS9DVX");

       client.request(req, dest);

       var response = client.getResponse(); 

      

    if(response.body){body = response.body.asString(); }

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

} catch (e) {

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

}

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Frank,

Like you, I am new in this too. I did get the error on "unsupported charset". One of the reasons is if you have put "http" or "https" in host parameter value. Remove it and try. Do post your destination file, if this remedy does not work.

Cheers.