Quantcast
Viewing all articles
Browse latest Browse all 3285

Request to xsjs on Microsoft Azure HANA cloud instance causes downloading xsjs file

Hi,

I follow the instruction to create a helloword xs project in Microsoft azure hana platform, the project uses form authentication, after creating and activating the xs project, when sending request to retrieveData.xsjs as below

 

http://fiori-han-128b28ca-2d06-47a4-8da7-80e4ef1a031a.cloudapp.net:8000/workshop/sessiona/00/cloudhello/retrieveData.xsjs

 

The Chrome browser will first show the logon page, after inputting the user name and password, then instead showing the html content based on retrieveData.xsjs's xsjs code, the chrome browser just downloads the file of retrieveData.xsjs to local.

 

The whole project is attached for your reference.

 

The content of .sxaccess is:

{

    "exposed" : true,          

    "authentication" :                                          

            {

              "method": "Form"

            },

 

    "cache_control" : "must-revalidate",

    "cors" :                    

            {

            "enabled" : false

            },

                  

    "enable_etags" : false,

    "force_ssl" : false,

    "prevent_xsrf" : true

}

 

 

 

 

The content of retrieveData.js is:

 

 

$.response.contentType = "tex/html";

var output = "hello world! <br><br>";

var conn = $.db.getConnection();

var pstmt = conn.prepareStatement("select * from DUMMY");

var rs = pstmt.executeQuery();

 

if (!rs.next()){

  $.response.setBody("Failed to retrieve data");

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

}

else{

  output = output +" this is the response from my sql: " + rs.getString(1);

}

rs.close();

pstmt.close();

conn.close();

$.response.setBody(output);

 

 

Thanks for any help for the issue

Jonathan


Viewing all articles
Browse latest Browse all 3285

Trending Articles