cancel
Showing results for 
Search instead for 
Did you mean: 

Problem connecting to B1 Service Layer

former_member260921
Participant
0 Kudos

Hi,

I am trying to log in to the B1 HANA service layer using example from the

"Working with SAP Business One Service Layer" document.

POST https://<Server Name/IP>:<Port>/b1s/v1/Login
{"CompanyDB": "US506", "UserName": "manager", "Password": "1234"}

When I run in a browser

https://MyServer:50000/b1s/v1/Login

with no parameters a prompt comes up and asks for UserName and Password but not CompanyDB which seems to confirm that the service layer is running and responding.

In Postman if fails with "Authorization header not found."

When I add the parameters with valid credentials:

https://MyServer:50000/b1s/v1/Login

{"CompanyDB": "SBODEMOUS", "UserName": "manager", "Password": "manager"}

In the Browser the user/password prompt comes up as before:

In PostMan the response is

{
"error" : {
"code" : 301,
"message" : {
"lang" : "en-us",
"value" : "Invalid session."
}
}
}

It seems like this is simple and should work and I am missing something obvious.

Thanks for any suggestions.

Mel

Accepted Solutions (1)

Accepted Solutions (1)

Eneveux
Product and Topic Expert
Product and Topic Expert
0 Kudos

Mel,

I think the data you are entering is in the wrong way ... it looks like you are trying to enter all of the information on a single line using the Login service. This is what it would look like in Postman ...

former_member260921
Participant
0 Kudos

Thanks, Eddie

Answers (2)

Answers (2)

former_member197733
Contributor

An address bar of a browser des GET requests.

What you are doing is a GET https://MyServer:50000/b1s/v1/Login which is wrong.

As Duncan suggested, use a REST Client to perform the operations. It will make your life easier.

Don't forget to ignore SSL error as he also mentioned.

Another alternative, for Development purposes, is to use the HTTP port of SL 50001. So you avoid the SSL warnings for self signed certificates.

Anyway, just avoid the usage of User and Passwords in the Address of your request. Otherwise everybody will have access to it.

former_member260921
Participant
0 Kudos

Thanks, Ralph

duncanspeidel
Advisor
Advisor
0 Kudos

Hi Mel,

Try using the following order of parameters in the body of your request: UserName, Password, CompanyDB. Something like:

{"UserName":"manager", "Password":"1234", "CompanyDB":"SBODEMOUS"}. There is no header for this request. In postman ensure that "SSL certificate verification" is off unless you are using a certificate from a trust root authority. If the problem persists check the error log from

/usr/sap/SAPBusinessOne/ServiceLayer/logs. It might provide more details.

Best regards,

Duncan

former_member260921
Participant
0 Kudos

Hi Duncan,

Thanks for your reply but I am still getting the same error.

I changed the order of the parameters and confirmed that "SSL certificate verification" is off.

https://hanab1vm2:50000/b1s/v1/Login{"UserName": "manager", "Password": "manager","CompanyDB": "SBODEMOUS"}

The response still says "Invalid Session".

Here is the log entry from /usr/sap/SAPBusinessOne/ServiceLayer/logs:

[20/Jun/2018:11:58:26 -0400] 192.168.1.30 TLSv1 AES256-SHA "POST /b1s/v1/Login%7B%22UserName%22:%20%22manager%22,%20%22Password%22:%20%22manager%22,%22CompanyDB%22:%20%22SBODEMOUS%22%7D HTTP/1.1" 107

Do I need to do something with a certificate even though verification is turned off?

Thanks,

Mel