Skip to Content
-1

XSJS Service HTTP call

Jul 13, 2017 at 01:48 PM

53

avatar image

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 : ' . ..... hanatrial.ondemand.com',

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

What could be causing this problem?

Thank You

-Diana

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Diana Fernanda Vazquez Romo
Jul 14, 2017 at 02:38 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded