Showing results for 
Search instead for 
Did you mean: 

Unable to connect to SAP business one through web service

Former Member
0 Kudos


I'm facing some problem with my web service. I tried to connect to SAP but it gave me an "System.Exception"

Public Function ConnectedToDatabase() As Boolean


Dim oCompany as SAPbobsCOM.Company

oCompany = New SAPbobsCOM.Company

Dim lRetCode, lErrCode As Long

Dim sErrMsg As String

sErrMsg = ""

Session("g_server") = System.Configuration.ConfigurationManager.AppSettings("Server")

Session("g_companyDB") = System.Configuration.ConfigurationManager.AppSettings("CompanyDB")

Session("g_DBUserName") = System.Configuration.ConfigurationManager.AppSettings("DbUsername")

Session("g_DBPassword") = System.Configuration.ConfigurationManager.AppSettings("DbPassword")

Session("g_Username") = System.Configuration.ConfigurationManager.AppSettings("Username")

Session("g_Password") = System.Configuration.ConfigurationManager.AppSettings("Password")

oCompany.Server = Session("g_server")

oCompany.CompanyDB = Session("g_companyDB")

oCompany.DbUserName = Session("g_DBUSerName")

oCompany.DbPassword = Session("g_DBPassword")

oCompany.UserName = Session("g_Username")

oCompany.Password = Session("g_Password")

oCompany.language = SAPbobsCOM.BoSuppLangs.ln_English

lRetCode = oCompany.Connect()

When the codes runs to the line IRetCode = oCompany.Connect(), it will return an error code -8006. Those session got the correct information from the web.config. Then exception is throw in.

I try restarting my com and restarting my suite manager. Usually this will solve the problem. However, it won't for this time. I hope will receive some solutions for my problem. Thanks for your time.

Edited by: Polytechnic Ngee Ann on Jun 29, 2009 9:17 AM

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

You may post it on this forum to get more responses:



Former Member
0 Kudos


Its a SDK Related questions so post a message to SDK Forum and check the link

*Close the thread if issue solved.



Edited by: Jambulingam P on Jun 29, 2009 9:20 AM