on 06-19-2018 8:37 PM
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
User | Count |
---|---|
106 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.