cancel
Showing results for 
Search instead for 
Did you mean: 

XSJS Service HTTP call

Former Member
0 Kudos

Hi, I am making a Node JS http request call to one of my xsjs services. I am not getting any text back. On the console log, I get a 302 status code. I looked this code online and it is apparently due to some type of redirection. As per (https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/7ccd3e4e-0501-0010-95ae-afa58cb46b75), it could be an authentication problem, but I am completely sure my service is public and requires no authentication.

On my http request call, I have

host : '<database name>.<username (i.e ....trial)>.....hanatrial.ondemand.com',

path: '/<application name>/<xsjs file name>.xsjs?param1=value1'

What could be causing this problem?

Thank You

-Diana

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

So, I was simply not handling the redirection.

One Node.js, the function, http.request(options, function(res) { }), does not handle redirection. So for instance, if you request 'http' vs. 'https', it will throw one of these 302 status codes. A better alternative I found, with some help, is the request function (https://www.npmjs.com/package/request). This does handle redirection.

Also here: https://stackoverflow.com/questions/7323932/how-do-you-follow-an-http-redirect-in-node-js