Skip to Content

In this blog we will describe what the SAP Business One License API is and how you can use it in your Add-on. 

With SAP Business One 2005, the License Service moved from DCOM to CORBA to avoid security issues as CORBA is not tied to Windows authentication. Due to this a License bridge to the License Service API was developed. In essence it wraps the CORBA interface which is exposed by the SAP Business One License Service with a COM wrapper.

How to install the License Bridge to access the API

Run the Setup.Exe from the COM License Bridge Setup package provided for download in the following link:

http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/508623e3-425c-2910-38be-cbe56e65930c

It’s important to Note that it will only work on the system where the License Service is running. Once it’s installed you can register it as a COM Server by Start -> All Programs -> SAP Business One -> Server Tools -> COM License Bridge -> Register COM License Bridge. You can also unregister it selecting Unregister COM License Bridge

How to use the COM License Bridge

1. Add a reference “SBOLicense COM Bridge 1.0 Type Library” in your Microsoft Visual Studio project

image

2.Declare a variable for the LicenseInfo interface

Dim lc As SBOLICENSELib.ILicenseInfo – VB

SBOLICENSELib.LicenseInfo lc = null; – C#

3.Instantiate the LicenseInfo interface:

lc = NewSBOLICENSELib.LicenseInfo – VB

lc = SBOLICENSELib.LicenseInfo(); – C#

Once this is done you can then access all the methods of the License API. You can find the full list of methods exposed in the SDK Help File.

Some examples of how to use the License Bridge

1. Retrieve the Hardware Key and Installation Number from your License Service.

Dim hk, ins as String 

lc.GetHardwareKey(hk)

lc.GetInstallationNumber(ins)

MsgBox(“Hardware key is ” & hk & ” and installation number is ” & ins)

 

2. Check if a particular user is assigned a Professional User License.

Please note bstrModule expects the SWPRODUCTNAME from the license file.

result = lc.IsUserLicensed(“manager”, “PROFESSIONAL_MSS”)

If result <> 0 Then

MsgBox(“User is licensed”)

Else

MsgBox(“User is not Licensed”)

End If

 

3. GetLicenseInfo allows you retrieve specific information from the license file.

Dim num, avail, start, dend as Integer

lc.GetLicenseInfo(“PROFESSIONAL_MSS”, num, avail, start, dend)

MsgBox(“For Addon SDK TEST you have ” & num & ” in your license file and ” & avail & ” available. License started on start ” & start & ” and expires on ” & dend)

 

4. GetLoggedinUsers returns a list of users currently logged into Business One – note this is via an XML file.

Dim xmlDoc As New Xml.XmlDocument

Dim productNodes As Xml.XmlNodeList

Dim ProductNode As Xml.XmlNode

Dim baseDataNodes Xml.XmlNodeList

Dim bFirstInRow As Boolean

lc.GetLoggedInUsers(users)

xmlDoc.LoadXml(users)

productNodes = xmlDoc.GetElementsByTagName(“users”)

For Each productNode In productNodes

baseDataNodes = productNode.ChildNodesbFirstInRow = True

For Each baseDataNode As Xml.XmlNode In baseDataNodes

If (bFirstInRow) Then bFirstInRow = False

Else

Console.Write(“, “)

End If

Console.Write(baseDataNode.Name & “: ” & baseDataNode.InnerText)

Next

Next

 

Planned changes in Version 8.8:

You can download the COM License Bridge for SAP Business One 8.8 from the link:

http://www.sdn.sap.com/irj/sdn/index?rid=/library/uuid/007a9ef5-9a9c-2d10-f3bc-94f765f235ce

 

Other information on the License Bridge in 8.8 can be found at:

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/webcontent/uuid/702bc48d-8c53-2d10-3697-c8e7cd126256?prtmode=wpcpreview&wpcpreviewkey=56c3851fb9accfe8b62ab9290d050e36

 

The planned changes in the license API are as follows:

  • GetInstallationNumberList method replaces the GetInstallationNumber method. The new method returns a list of installation numbers for the loaded license file, instead of a single number.
  • GetSystemNumber method’s arguments have changed. The installation Number is passed to get the related system number.
  • IsLicenseFileExist is no longer supported.

In two weeks time, our blog will cover the topic of the SBO_SP_TransactionNotification stored procedure. So catch you then 🙂

To report this post you need to login first.

29 Comments

You must be Logged on to comment or reply to a post.

  1. Ad Kerremans
    I made a program (service) that checks the logged in users every 5 minutes. The program has been run for some time an suddenly the following error occur.

    Error HRESULT E_FAIL has been returned from a call to a COM component.

    The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))

    Nothign has changed on the system en re-registering the dll doesn’t help.

    What is wrong and what can I do about it.

    Ad

    (0) 
    1. Lisa Mulchinock Post author
      Hello Ad,

      I’m not sure what could cause this but i have additional questions about it:
      * What methods of the API are you calling when the error occurs?
      * Can you reproduce it each time or is the error random?
      * Did anything change in the system (e.g upgrade, windows update etc)
      * Can you reproduce it looking through a .net sample (not a service)?

      Thanks,
      Lisa

      (0) 
      1. Ad Kerremans
        Hello Lisa,

        I am calling GetLoggedInUsers and the error occurs every time on that server.
        Nothing was changed and re-registering the dll doesn’t help either.
        Using a .net sample the error doesn’t occur.
        I have the same program running on another server without problems.

        Regards

        Ad

        (0) 
        1. Lisa Mulchinock Post author
          Hello Ad,

          I have checked this on 2007A FP1 PL06 but wasn’t able to reproduce it. If it can’t be reproduced on another server then it seems that its an environment specific issue. If its still occuring it would be best to log a support message so we can do some in dept investigation to find the root cause of the issue.
          Cheers,
          Lisa

          (0) 
  2. Greg Neilson
    Hi,

    I’ve downloaded the code for the bridge. However, it seems two source files are missing :

    LicenseInterfaceC.cpp
    LicenseInterfaceC.h

    Do you know who’s responsible for maintaining this code? Where can I get the missing files from?

    Cheers,
    Greg

    (0) 
    1. Greg Neilson
      Hi Lisa,

      Are you able to give any indication as to when the changes to the bridge needed to support 8.8 are likely to be released? Also, are you able to send me the missing files from the current source download for the bridge?

      Cheers,
      Greg

      (0) 
        1. Greg Neilson
          Hi Lisa,

          I tried the bridge on 8.8 PL 02 (using the test application also available on the download page)

          It fails on init somewhere inside the bridge with an E_FAIL, and fails on the other calls into the bridge also (presumably because the init failed). I haven’t been able to debug much further (mainly because I can’t compile up the bridge code). Perhaps something has changed in the CORBA interface with 8.8?

          You also mentioned in your blog post here there are some changes coming for the bridge, so this might explain it my errors?

          Cheers,
          Greg

          (P.S apologies on the triple posting, when you post a comment on the blog there’s no verification that the post was accepted, and it doesn’t appear atraight away, so I thought it wasn’t working!)

          (0) 
          1. Greg Neilson
            Hi Lisa,

            Any info on this, or the missing code files? I would appreciate being able to compile the bridge so I can at least try and diagnose what the errors I’m getting are.

            Cheers,
            Greg

            (0) 
            1. Lisa Mulchinock Post author
              Hey Greg,

              I’m still waiting for clarification on one issue.
              In the meantime I will update you on what i know so far:

              – Firstly i have replied to Joel regarding your questions on License and Support so hopefully you have been forwarded on that information.

              – Regarding 8.8 changes as per the information in the blog GetInstallationNumber has been removed and the methods IsUserLicensed, GetInstallationNumberList, GetLicenseInfo, GetSystemNumber and GetLicenseNum parameters have been changed. All these changesare documented in the 8.8 compatibility document also.

              – Regarding the missing files i have been told that you need to compile the LicenseInterface.idl file and you will get these 2 files. I have tried to do this but was unable to. So I have asked for clarification on how to do this – this is the only open question i have.

              Cheers,
              Lisa

              (0) 
              1. Greg Neilson
                Hi Lisa,

                Yes, I have received the email from Joel, many thanks for that.

                I can see the changes in the 8.8 compatibility document. That’s good, but seeing as there is apparently no documentation available on the current License API, it doesn’t mean a lot as I can’t compare it to what was there already! Is there no documentation available at all for the CORBA interface on the License API I can get hld of? Support has told me there is nothing, which means I’m faced with using an undocumented API to do what I want, hence the need to compile the bridge code to see how it works.

                As far as the missing code goes, I think someone has misundertsood what you’re asking. For starters, LicenseInterface.idl isn’t in the source code. Assuming that SBOLicense.idl is what’s meant, that isn’t going to help as using the MIDL compiler on this will just produce proxy/stub files for the COM bridge, along with a type library. The missing files are those which relate to the communication between the COM bridge and the License API CORBA interface, i.e. they are those which actually hold the key to the workings of the License API! Now it may be that these are generated somehow from the License API – I don’t have any experience with CORBA so am unsure as to if/how a client side files are generated for such an interface – but I’m pretty sure you won’t be able to do this with COM tools such as the MIDL compiler.

                Hope you can get an answer about the files from someone.

                Cheers,
                Greg

                (0) 
                1. Greg Neilson
                  OK, done some reading up around how CORBA works. It seems CORBA uses an IDL file to describe the interface in a similar way to the one used for COM. So, the advice you were given may be close to the mark – however, the LicenseInterface.idl file (if this is the CORBA IDL file) is also missing from the source code distribution.

                  I don’t know, however, what sort of compiler is needed to auto generate source files from the CORBA IDL file though.

                  Hope this helps.

                  Cheers,
                  Greg

                  (0) 
    2. Greg Neilson
      Hi Lisa,

      Are you able to give any indication as to when the changes to the bridge needed to support 8.8 are likely to be released? Also, are you able to send me the missing files from the current source download for the bridge?

      Cheers,
      Greg

      (0) 
    3. Greg Neilson
      Hi Lisa,

      Are you able to give any indication as to when the changes to the bridge needed to support 8.8 are likely to be released? Also, are you able to send me the missing files from the current source download for the bridge?

      Cheers,
      Greg

      (0) 
    4. Lisa Mulchinock Post author
      Hi Greg,

      Firstly apologies for the delay replying to you. I didn’t get a notification of this question for some reason and only saw it after receiving your new question.

      I have also tested the sample and saw that the two files are missing. I will follow up on this but in the meantime you can use the sample in the blog if you want to test the functionality.

      I will be in touch as soon as i have an update.

      Cheers,
      Lisa

      (0) 
  3. Markus Rewak
    hi,

    i’m using sap 8.8 pl12.
    I registered the License Bridge, added a reference to my project and now i’m using SBOLicense, but i get not values.

    The method lic.getHardwarekey(sHK) returns no value. My variable is empty (sHK=””).

    Can anybody help me?

    Markus

    (0) 
    1. Lisa Mulchinock Post author
      Hi Markus,

      I have tested this on 8.8 PL14 and correctly returned the HardwareKey value.
      Can you unregister and re-register the COM license bridge?

      Cheers,
      Lisa

      (0) 
  4. Ben Marty
    I have not been able to get anything to work with the 8.81 license server, and there appears to be to COM License Bridge designed for 8.81.  I downloaded IIOP.NET and am trying to write an interface directly to CORBA, but even now (after great pains to figure out how to get IIOP.NET to believe that I have a compatible interface — I know very little of CORBA and IIOP) I am getting an empty string back from GetHardwareKey.  I’d kind of like to directly access the CORBA interface from .NET code rather than having a layer of COM in between, but really we just need any solution to get a hardware key from an 8.81 license server.
    (0) 
    1. Ben Marty
      Sorry, when I said “appears to be to COM License Bridge”, I meant “appears to be NO COM License Bridge” for 8.81.
      (0) 
      1. Lisa Mulchinock Post author
        Hi Ben,

        I replied to your Customer Message so we can try to find the root cause of this issue.
        I will update this post once we find the answer.

        Cheers,
        Lisa

        (0) 
        1. Ben Marty
          It seems my test with 8.81 might have been flawed since I have seen cases where the COM license bridge can work a version 8.81 license server. But the problem remains that the license agreement on the 8.8 COM license bridge is a 90 day evaluation license. I think something more permanent is in order. I have my IIOP.NET solution, so unless a non-COM solution takes the place of the COM license bridge, I probably won’t switch (this works much better than COM).  But in any case, I would expect something more than a 90 day evaluation license.
          (0) 
  5. Bhavank Gajjar
    Hello Expert,

    I am using 8.81 PL5,I have used COM Licence Bridge 2.0 for 8.81 in my Add-on.

    When I try to run Add-on from Server it works Fine for Following Code but it throws Exception for Client Machine.

    Dim HKEY As String = “”
    Dim LicInf As SBOLICENSELib.LicenseInfo = New SBOLICENSELib.LicenseInfo
    LicInf.GetHardwareKey(HKEY)

    Please help me out!!

    Regards,
    Bhavank

    (0) 

Leave a Reply