Best way to create trial licenses automatically
I would like create a temporary trial license as soons as my application gets installed for the first time that is valid for 30 days. Therefore I'm implementing a "Start Trial" button that should take the Computer ID, send the ID to the QLM Webservice and the Service checks if the Computer ID has already been allowed to start a trial. If the Computer ID already took part in the trial, an error message should appear. If the Computer ID has never requested a trial key, then send one back and save it.
How do I accomplish this with QLM? As I've seen in the WS API there is currently no such call that allows a trial key request. For safety reasons I guess the only parameters should be the product name and the ComputerID. The response should consist of the activation key.
Have I overseen such a WS method or is there any sample that implements this way of trial licenses? Or are there any other more safe trial approaches possible with QLM? I want to avoid saving the installation date anywhere as this is clearly not a good approach. Many of my beta testers are already using things like Sandboxie for example for trying out my app, so they can easily find out where the trial expiration date gets saved.
Thank you for your help!
P
-
Official comment
In the latest version of QLM, we have added a new method that should meet your requirements: CreateComputerBoundTrialKey
From the online help:
Creates a trial activation key, then automatically activates it on the server side and returns the computer bound license key. This function is useful if you want to create trial keys from within your application. The trial period is controlled by the trialDuration Server Property. Server Properties can be set from the Manage Keys / Sites / Server Properties page.
Prior to calling this function, you must call DefineProduct and set the CommunicationEncryptionKey property.
If you want to prevent calls to this function, set the enableCreateComputerBoundTrial Server Property to false. The Server Properties can be set from the Manage Keys / Sites / Server Properties page.
C#: string CreateComputerBoundTrialKey(string webServiceUrl, string computerID, string computerName, string email, string features, string affiliateID, string userData1, out string response)
Parameters
webServiceUrl - URL to the QLM Web service.
computerID- Unique identifier of the computer being activated.
computerName - Friendly name of the computer being activated.
email - email address to associate to the license key - may be empty
features - Semi comma separated list of feature sets and ther corresponding values.
Example: 0:1;1:2;2:3;3:6 - enables feature 1 in feature set 0, feature 2 in feature set 1, feature 1+2 (3) in feature set 4 and features 1+2+3 (6) in feature set 3.affiliateID - ID of affiliate
userData1 - user data to associate to this license
response - XML fragment containing the result of the call. The Xml fragment schema is as follows:
<?xml version='1.0' encoding='UTF-8'?>
<QuickLicenseManager>
<pckey>C06C4C90A497F091C2F080501000C076A0578E</pckey>
<userCompany>My Company</userCompany>
<userFullName>John Smith</userFullName>
<userEmail>john@smith.com</userEmail>
</QuickLicenseManager>Return value: The returned value is the computer bound license key (ComputerKey).
Comment actions -
Nice! Have not updated since January.
Unfortunately I'm getting the following exception when calling the method:
"System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.InvalidOperationException: There was no XML start tag open.
at System.Xml.XmlTextWriter.InternalWriteEndElement(Boolean longFormat)
at System.Xml.XmlTextWriter.WriteFullEndElement()
at Qlmsvc.IsResult.WriteFullEndElement()
at QlmWebService.QlmService.CreateComputerBoundTrialKey(String eComputerid, String computerName, Int32 productID, Int32 majorVersion, Int32 minorVersion, String email, String features, String affiliateID, String userData1, String& response)
--- End of inner exception stack trace ---"
EMail, AffiliateID and UserData are empty.
Thank you for your help!
-
Try replacing the nulls with string.Empty.
Sample code:
private string CreateTrialKey ()
{string response = string.Empty; string webserviceUrl = "http://quicklicensemanager.com/qlmdemov7/qlmservice.asmx"; string key = lv.QlmLicense.CreateComputerBoundTrialKey(webserviceUrl, Environment.MachineName, Environment.MachineName, "john@soraco.co", "", "", "", out response); if (String.IsNullOrEmpty (key)) { ILicenseInfo li = new LicenseInfo(); string message = string.Empty; if (lv.QlmLicense.ParseResults (response, ref li, ref message)) { MessageBox.Show(this, message); } else { MessageBox.Show(this, "Failed to parse results: " + response); } } return key; } -
As of QLM 8.1, you can embed a registration page on your web site to automatically create trial keys and email them to your customer.
For more details, check this article.
Please sign in to leave a comment.
Comments
11 comments