Skip to Content
avatar image
Former Member

Send params in request body HANA XSJS


i made some requests using xsjs, calling external webservices, but now I need to call and pass the params in the request body, not in the url as i have been doing.

So, i need to generate this exact call, which i now it works i postman

here is my code, wich does not work.

var res;

var response;
var dest = $.net.http.readDestination(destination_package, destination_name);
var client = new $.net.http.Client();
var req = new $.web.WebRequest($.net.http.POST, "upload_file");
//var req = new $.net.http.Request($.net.http.POST, "upload_file");
        id: id,
        filename: filename,
        extension: extension,
        checksum: checksum,
        type_id: typeId,
        the_file: theFile,
        user_id: userId
client.request(req, dest);
response = client.getResponse();
res = response.body.asString();

So, i must be missing something, but I don't know what. I tryed with $.net.http.Request instead of $.web.WebRequest but the result is the same.

Please, any help would be appreciated.

Thank you

postman.jpg (52.8 kB)
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • May 06, 2018 at 11:30 AM

    Hello Luis - am looking to make an exact similar call. Please can you share if and how you fixed this.



    Add comment
    10|10000 characters needed characters exceeded