Finding the Expiration Date of a License

Declare Variables/Constants

String FEATURE_NAME =  "Feature1";
String FEATURE_VERSION = "1.0";
String CONTACT_SERVER  = "localhost";
String ScopeFeatureInfo = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+     
                          "<sentinelScope>"+
                               "<feature index=\"0\">"+
                                   "<name>"+FEATURE_NAME+"</name>"+
                                   "<version>"+FEATURE_VERSION+"</version>"+
                               "</feature>"+
                          "</sentinelScope>";
Attribute attrAppContext = null;            ApplicationContext appContext = null;

API Calls

To know the expiration data of 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.

> appContext = new ApplicationContext(attrAppContext);

>String featureInfo = appContext.getInfo(ScopeFeatureInfo, LicensingConstants. SNTL_QUERY_FEATURE_INFO_VERSION("1.0"));

On success, featureInfo contains an XML output having the detailed information. Parse the XML, the “deathTime” tag in this XML contains the epoch timestamp for the license expiration.

NOTE   Refer to the sntl_demo.cs sample of the Unified API (in the Sentinel RMS SDK installation) for a specific API function, its parameters, and usage.