Skip to Content
author's profile photo Former Member
Former Member

DI / JCo: Error using SBOBob.GetItemPrice() from webservice

I am trying to use the SBOBob.GetItemPrice() function from a webservice but it keeps raising an error when I call it. The error is:

[System.Runtime.InteropServices.COMException]

ErrorCode: -2147417851

Message: "The server threw an exception."

Using it from the sample project '3.UsingSBObob' works fine.

Can anyone confirm if they have the same problem or better, give me a solution?

Code:

<WebMethod()> _

Public Function GetItemPriceTest() As String

Dim oCompany As SAPbobsCOM.Company = New SAPbobsCOM.Company

oCompany.Server = ConfigurationSettings.AppSettings("SBOServer")

oCompany.CompanyDB = ConfigurationSettings.AppSettings("SBODatabase")

Dim dbUserName As String = ConfigurationSettings.AppSettings("SBODBUserName")

If (dbUserName.Length > 0) Then

oCompany.UseTrusted = False

oCompany.DbUserName = dbUserName

oCompany.DbPassword = ConfigurationSettings.AppSettings("SBODBPassword")

Else

oCompany.UseTrusted = True

End If

oCompany.UserName = ConfigurationSettings.AppSettings("SBOUserName")

oCompany.Password = ConfigurationSettings.AppSettings("SBOPassword")

oCompany.Connect()

oCompany.GetLastError(m_lastError, m_lastErrorMsg)

If m_lastError <> 0 Then

Throw New Exception("Error", Nothing)

End If

Dim oBridge As SAPbobsCOM.SBObob = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoBridge)

Dim oRs As SAPbobsCOM.Recordset = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

' This one raises an error

oRs = oBridge.GetItemPrice("C1000", "A1000", 100D, Now)

Return oRs.Fields.Item(0).Value & " " & oRs.Fields.Item(1).Value

End Function

Add comment
10|10000 characters needed characters exceeded

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on May 24, 2004 at 02:20 PM

    Update of the poster:

    The other methods of the SBOBob object seem to work correctly in the webservice, only the GetItemPrice() method raises an error.

    Anyone brave enough to test this in Visual studio .NET?

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 26, 2004 at 03:31 PM

    Update of the post

    The problem only occurs on Windows Server 2003 in a webapplication. This has probably something to do with IIS 6.0 (instead of IIS 5.0 on a windows 2000/XP).

    Can anyone test this on Windows Server 2003 to see if they have the same problem?

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Tom,

      as stated in our communication outside this forum, I could reproduce this error.

      Regrettably this issue is likely not to be fixed in 6.5 as Windows Server 2003 will first be officially supported by the next release!

      Check it out in the "Product Availability Matrix" (PAM) on "SAP Service Marketplace" (SMP):

      Enter /sbo-swcenter and then in the menu on the right (?) side: "Support Packages & Patches" / "SAP Business One Releases prior to SBO 2004"

      Now see the text below "SAP Business One Releases prior to SBO 2004".

      There's a link to the "PAM"...

      Regards,

      Frank