Uninstall a License from the License Manager

Declare Variables/Constants

String CONTACT_SERVER = "localhost";
/* Replace the empty string below with the license string to be uninstalled from LM */
String LICENSE_STRING = "";
String LICENSE_HASH = “”;
String strLicense = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>”+
                     “<uninstallData>”+
                         “<license>"LICENSE_STRING"</license>”+
                         “<licenseHash>LICENSE_HASH</licenseHash>”+
                     “</uninstallData>";
 
Attribute attrAppContext    = NULL;
ApplicationContext pAppContext = NULL;

API Calls

To uninstall a license, execute the APIs in the specified sequential order only:

>attrAppContext = new Attribute();

>attrAppContext.set(LicensingConstants.SNTL_ATTR_APPCONTEXT_CONTACT_SERVER, CONTACT_SERVER);

NOTE   If instead the LSFORCEHOST or LSHOST environment variables are set, then the above mentioned steps are not required.

>ApplicationContext appContext = new ApplicationContext(attrAppContext);

>String License = appContext.uninstall(strlicense);

On success, the license string specified in the macro LICENSE_STRING/LICENSE_HASH will get deleted from the license manager and the parameter License will contain the license hash and license string (If it is available in the license file) of the uninstalled license in XML format.

NOTE   You can obtain the license hash using the licenseInfo query of the getInfo API for licenses already installed on the License Manager.

Notes

You may refer to the sntl_tool sample (installed in the Sentinel RMS SDK) for further understanding of the usage of uninstall or any of the above mentioned Unified APIs.