Skip to Content

Calling Service Layer from XS Application

Dec 11, 2017 at 05:37 PM


avatar image


I have situation where my client wants to update SAP entities via the XS Application. To allow this without invalidating the SAP data, I need to call the Service Layer (unless there is a better way)

I've looked for a similar answer but most of what I found appeared to be faults that I have corrected.

The error message is "{"error":"HttpClient.request: request failed: internal error occurred \"Failed to send request to socket...rc = -1\""}".

B1SL.xshttpdest is set up in trust manager

host = "";
port = 50000;
pathPrefix = "/b1s/v1/";
authType = none;
useSSL = true;
timeout = 0;

My test.xsjs service:

function respond(obj){
    $.response.contentType = "application/json";
    $.response.status = $.net.http.OK;
var client = new $.net.http.Client();
var destination = $.net.http.readDestination("b1s.v1.Libs", "B1SL");
var req = new $.web.WebRequest($.net.http.GET, 'Items');
    client.request(req, destination);
    var response = client.getResponse();

Where have I gone wrong?


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

0 Answers