Best way to create trial licenses automatically

Comments

11 comments

  • Official comment
    Avatar
    Soraco Technologies

    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 Permalink
  • Avatar
    barnacleboy

    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!

    0
    Comment actions Permalink
  • Avatar
    barnacleboy

    Maybe this entry from the WS Log helps a little bit more:

    EventID 160, Category IssueActivationKey and Details: Object reference not set to an instance of object.

    0
    Comment actions Permalink
  • Avatar
    Soraco Technologies

    Hi

    Could you send me more details about how you are calling the function?

    Thanks
    John

    0
    Comment actions Permalink
  • Avatar
    barnacleboy

    license.CreateComputerBoundTrialKey("URL", "COMPUTERID", "COMPUTERNAME", null, "0:34;1:36;2:36;3:36", null, null, out res);

    I want to activate all features except the second from the first set.

    0
    Comment actions Permalink
  • Avatar
    Soraco Technologies

    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;
    
        }
    
    0
    Comment actions Permalink
  • Avatar
    barnacleboy

    Using string.emptys makes no difference, I've already tried that. The exception is always there... Should I provide you access to the service to get more insights?

    0
    Comment actions Permalink
  • Avatar
    Soraco Technologies

    Yes, please.

    0
    Comment actions Permalink
  • Avatar
    barnacleboy

    The key works fine now, but when I'm removing the key and send the request for another key again, I'm getting a different key back from the web service. Shouldn't I get always the same trial key for the same computer ID?

    0
    Comment actions Permalink
  • Avatar
    barnacleboy

    By removing the key I've meant removing from my settings file where I keep activation and computer key.

    0
    Comment actions Permalink
  • Avatar
    Soraco Technologies

    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.

    0
    Comment actions Permalink

Please sign in to leave a comment.