cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Business One Service Layer - Internal Server Error

Former Member

Hi

I have installed B1 HANA Platform and SAP B1 version for HANA PL05, everything went well. I started to test the service layer writing a simple Python application to consume its REST service. In the first tests it was working fine, the Service Layer returned the B1SESSION and ROUTEID, but after a while it stopped to work, the same code that was working before now it is not anymore. I tried to consume the service using Advanced Client Rest (plugin for Chrome) and I got the same result as the Python code.

I tried to restart the Service Layer service, it didn`t work. I also restarted all the SuSE OS but it didn`t work too.

My doubt now is if the Service Layer got some trouble with session management and after I connected several times it didn't manage to sort out the session for the requester anymore.

Request (python)

import requests
import ssl

task = {"CompanyDB": "SBOBRGT", "UserName": "i000001", "Password": "erp@123"}
resp = requests.post('https://xxx.xxx.xx.x:50000/b1s/v1/Login', json=task, verify=False)

print(resp.status_code)
print(resp.content)


Response

Status
500 Internal Server Error  Loading time: 2215

Request headers 
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36

Origin: chrome-extension://bljmokabgbdkoefbmccaeficehkmlnao
Content-Type: application/x-www-form-urlencoded
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4
Cookie: ROUTEID=.node3

Response headers 
Date: Mon, 05 Dec 2016 00:38:49 GMT
Server: Apache/2.4.7 (Unix)
DataServiceVersion: 3.0
Content-Type: application/json;odata=minimalmetadata;charset=utf-8
Vary: Accept-Encoding
Content-Encoding: gzip
Connection: close
Transfer-Encoding: chunked

Response Body

{
    error: {
      code: -1000
      message: {
        lang: "en-us"
        value: "Internal server error."
      }
     -
    }
-
}

Accepted Solutions (0)

Answers (5)

Answers (5)

0 Kudos

import requests

import urllib3import jsonimport configparser


config = configparser.ConfigParser()config.read('config.ini')urllib3.disable_warnings()
url =config['URL']['URL_LOGIN']CompanyDB =config['LOGIN']['CompanyDB']Password =config['LOGIN']['Password']UserName =config['LOGIN']['UserName']url2 =config['URL_OP']['Url_Oinm']myobj = {'CompanyDB': CompanyDB,'Password': Password,'UserName': UserName}

r = requests.post(url,json=myobj,verify=False)data = r.textrespuesta = r.status_code
if respuesta := "200":
url2 = url2 r2 = requests.get(url2,cookies=r.cookies,verify=False) data2 = r2.text employeeJSON = json.loads(data2) print(json.dumps(employeeJSON["value"]))else: print("Error en Conexion")


0 Kudos

My sample code as below, it works fine to me

Code:

import requests

url = 'https://xxxxx:50000/b1s/v1/Login'headObj = {
"Content-Type":"application/json",
"Connection" : "keep-alive"}
myObj ={
"CompanyDB": "DBName",
"Password": "paxxword",
"UserName": "accountname" }

r = requests .post(url, headers = headObj,verify=False, json=myObj)

print(r.text)

Result:

{ "odata.metadata" : "https://xxxxx:50000/b1s/v1/$metadata#B1Sessions/@Element", "SessionId" : "xxxxxxxxx123456468797978975464", "Version" : "1000130", "SessionTimeout" : 30 }

0 Kudos

To compare with yours, I have add `header` info.

mta1
Explorer
0 Kudos

A restart of the service layer has fortunately solved the problem.

mta1
Explorer
0 Kudos

We are currently having this issue after the SAP user (domain user) changed his password:
The login via HTTPS URL fails from the C # application while it works from the Chrome extension "Y.A.R.C".
The login via HTTP-URL and the try of the worker-ports (50001, 500002, 500003 and 500004) showed that only at the last login (with port 500004) works, in the first three we get the error message "-1000" / "Internal server error."

We try it first with a restart of the service layer and will post the result here.

Former Member
0 Kudos

I have uninstalled Service Layer and installed it again and now it is working.

If someone else have faced this problem and solved in anther way, please share it here.