cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Connecting Service Layer from Development Workbench

former_member260921
Participant
0 Kudos
253

Hi,

I am trying to login to the B1 service layer using Web-based Development Workbench Editor on my on premise HANA system - see code below. The code works in the SAP Web IDE (pointing to the server using destination) but when I try to run from the Workbench Editor with the server url it fails. When I look at the POST in the Network tab the Params are blank as well as the Response.

What is the best way to connect to the service layer from Development Workbench? Is it possible to do it without going through XS?

Also why does $.ajax send the parameters from the SAP Web IDE but not the workbench.


Thanks,

Mel

var surl = this.serviceLayerUrl + "Login";
loginInfo = {"UserName":"manager", "Password":"manager","CompanyDB":"SBODEMOUS"};
$.ajax({
type: "POST",
url: surl,
xhrFields: {
withCredentials: true
},
data: JSON.stringify(loginInfo),
error: function(xhr, status, error) {
oLabelLogin.setText("Login Failed");
}
}

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member197733
Contributor
0 Kudos

There is an example of how to it on our Github.

Check the B1SLLogic.xsjslib

Basically we replace the SAP CP destination with an xshttpdest file.