Skip to Content

COM License Bridge To Cobra License Manager 8.8 and 9.0

This page describes how to install and use the “SAP Business One COM License Bridge” to connect to the SAP Business One CORBA License Manager. This COM License Bridge “wraps” the CORBA interface which is exposed by the SAP Business One License Service since version 2005 with a COM wrapper.

Ready-To-Use “COM License Bridge” Exposes License Service API

When trying to establish DCOM connections from client PCs to servers that are running in a different domain or workgroup, security issues are common problems. Therefore the License Service was moved from DCOM technology to CORBA with the SAP Business one 2005 release. With CORBA such issues do not exist since it is not tied to Windows authentication. 

It happens though that SAP Business One partners request functionality that is available in the License Service API. In an effort to accommodate these requests a COM “License Bridge” to the API of the License Service has been developed. It “wraps” the CORBA interface which is exposed by the SAP Business One License Service since version 2005 with a COM wrapper. 

The COM_B1License.exe is a COM server which could run as a Windows service as well. For B1 version 2007 it provides the same interface as available in SAP Business One version 2004:

  • All CLSIDs and IIDs from the 2004 COM License Server are being reused.
  • If the 2004 interface had already been used – the License Bridge would allow using 2004-based code to run without rebuilding.

Some interfaces are changed in 8.8 version. Please refer to the following section for details (Interface change in 8.8 comparing to 2007 A/B).

How To Install / Uninstall The "COM License Bridge"

You can easily install the COM License Bridge by simply running the Setup provided for download in SDN. The LicenseBridge exe can be installed in any directory.

Please note: that the COM License Bridge will only work on the system where the actual License Service is running.

Please note: that COM License Bridge uses Microsoft Visual C++ 2005 runtime libraries. Please install the "Microsoft Visual C++ 2005 Redistributable Package (x86)" which can be downloaded from www.microsoft.com when you don't have the runtime libraries installed yet.

Please note: that if you would like to install the COM License Bridge into the directory where the regular SAP Business One License service is installed this directory is maintained by the SAP Business One Server Tools Installer. Therefore special attention has to be paid to the License Bridge during any subsequent Server Tools Update process.

Interface Change In 8.8 Comparing To 2007A/B

New Interfaces in 8.8 version:

  • boolean IsUserLicensed(in wstring wstrUser, in wstring wstrModule, in wstring wstrInstallNo);
  • long GetInstallationNumberList(out wstring wbstrInstNum);
  • long GetSystemNumber(out wstring wbstrSysNum, in wstring wstrInstallNo);
  • long GetLicenseInfo(in wstring wstrModule, out long lNum, out long lAvailable, out long lStart, out long lEnd, in wstring wstrInstallNo);
  • long GetLicenseNum(in wstring wstrKey, in wstring wstrInstallNo);
  • ld Interfaces in 2007A/B version (changed in 8.8):boolean IsUserLicensed(in wstring wstrUser, in wstring wstrModule);
  • long GetInstallationNumber(out wstring wbstrInstNum);
  • long GetSystemNumber(out wstring wbstrSysNum);
  • long GetLicenseInfo(in wstring wstrModule, out long lNum, out long lAvailable, out long lStart, out long lEnd);
  • long GetLicenseNum(in wstring wstrKey);

Update History:

A new version of COM License Bridge has been uploaded to support both SAP Business One 8.8 and 9.0. Here list the issues:

  1. When reading hardware key and system number with COM License Bridge for SAP Business One 88 or 90, there is an additional char (BOM-Byte Order Mark) at the beginning of the returned string for hardware key or system number. This is introduced by new version of TAO, no fix available in COM License Bridge, which need to be resolved in the Add-On code by skipping the leading unused char. Here you have sample code how to skip this leading additional char.

private string StringConvert(string str) {

            char[] ch = str.ToCharArray();

            if (ch.Length > 0)

                if (ch[0] == 65279) {

                    //Skip the leading Byte of Mark character(=65279).

                   StringBuilder sb = new StringBuilder();

                    for (int i = 1; i < ch.Length; i++)

                    {

                        sb.Append(ch[i]);

                    }

                    return sb.ToString();

                }

            return str;

        }

  2.  The license server always return 0, when reading number of any license from license server it. Here is the issue thread: http://scn.sap.com/thread/3351706

This issue has been fixed in this updated version of COM License Bridge for SAP Business 8.8 and 9.0 versions.

Downloading The COM License Bridge

You can download the COM License Bridge setup directly together with some samples and the source code from here:

COM License Bridge for SAP Business One 8.8 and 9.0

Running The COM License Bridge

You don’t need to run the COM License Bridge executable, only by registering it as a server plus instansciating it from your code as a COM interface will launch it. The License Bridge could be registered as a Windows service, but this should not be necessary on versions of the operating system which are officially supported; even more, registering the License Bridge has proven to cause the mechanism used in the COM_TestLicense sample to fail.

Registering The COM License Bridge

You need to register the COMLicenseBridge as a COM Server prior to use it. To register the LicenseBridge as a COM Server you need to call:  COM_B1License.exe –RegServer  Or use the “Register COM License Bridge” menu inside All Programs -> SAP Business One ServerTools -> COM License Bridge -> Register COM License Bridge.

Un-registering The License Bridge

You can unregister the COM License Bridge server by calling: COM_B1License.exe -UnregServer  Or use the "Unregister COM License Bridge" menu inside All Programs -> SAP Business One ServerTools -> COM License Bridge -> Unregister COM License Bridge.

Logging

The bridge logs “events” into the Windows event log so that the events are visible in the Windows Event Viewer. To disable logging to the Windows Events System, add the following key to the registry and set its value to “false”:  HKEY_LOCAL_MACHINE\SOFTWARE\SAP\SAP Manage\LicenseManager\EnableEventLog

Using The COM License Bridge

After installing the COM License Bridge and registering it you are ready to use it from your add-on code. Together with the Setup you have 2 C# samples showing you how to use the COM License Bridge, one developed for Visual Studio .NET 2003 and the second one for Visual Studio .NET 2005. Please download the “Sample_COMLicenseBridge” corresponding to your Visual Studio .NET version to see how to use the COM License Bridge. Please note that the sample can work with the SAP Business One 2004 license service as well.  Please find a full list of all available functions in the SAP Business One SDK Help Center, section “SAP Business One License API”.

The Sample_Comlicensebridge

The code sample is provided as C# Windows application project to show you how to use the COM License Bridge. The sample contains all publicly available methods – two of them are disabled though to avoid any unintended usage: LoadLicenseFile + ResetAllLicensesAfter Initializing the COM interface a couple of API methods are called to provide some basic information. The calls to further API methods are implemented in handlers for the corresponding Click events.

The most important steps how to use the API can be summarized as follows:

  • Add a reference to “SBOLicense COM Bridge 1.0 Type Library” in your Microsoft Visual Studio project.
  • Declare a variable for the LicenseInfo interface: SBOLICENSELib.LicenseInfo lc = null;
  • Instantiate the LicenseInfo interface:  lc = new SBOLICENSELib.LicenseInfo();

Using the interface is fairly straightforward: E.g. check whether user "manager" has been assigned SAP Business One Professional User license: Check for the SWPRODUCTNAME corresponding to Professional User license in the license file - in this case SWPRODUCTNAME = PROFESSIONAL_MSS.  The code could e.g. look like this: int result = lc.IsUserLicensed("manager", PROFESSIONAL_MSS); if (result != 0) MessageBox.Show("User is Licensed"); else MessageBox.Show("User is not Licensed: " + result);

Frequent Requirements

  • Number of Add-On users to be identical to Professional users:

  • Type of license the user has / related to functions - especially for applications that use DI API only:

From there you would need to reflect license type vs. the actual functionalities in the B1 application which would be accessible for a particular user - or read-only - or not. Please note that a functionality that fully fulfills this requirement is available through UI API: Application.Company.GetFormLicenseStatus(ByVal FormType As String) As BoLicenseStatus

How To (Re-)Build The (COM) License Bridge Source Code

The License Bridge is based on Open Source Libraries ACE and TAO: ACE(TM) and TAO(TM) are copyrighted by Douglas C. Schmidt and his research group at Washington University, University of California, Irvine, and Vanderbilt University Copyright (c) 1993-2003, all rights reserved.

The core components of the License Bridge are:

  • The CServiceModule class in the SBOLicense.cpp file which provides standard interfaces to register, unregister and run the License Bridge.
  • The CLicenseInfo class in the LicenseInfo.cpp file which actually exposes the API

To rebuild the License Bridge it is necessary to:

  • Download the C++ source code for ACE and TAO libraries from http://download.dre.vanderbilt.edu/ and rebuild the libraries (*.lib).
  • Build the License Bridge itself.
  • Link it with the ACE + TAO libraries.

At this point in time only the versions ACE 5.5 / TAO 1.5 are available through the link above though. Please note that the builder of the resulting License Bridge will have to assume full responsibility for any issue related to this build and its usage!

Tags:
Former Member

No comments