QlmLicense.GetProductProperties returning empty string

Comments

5 comments

  • Official comment
    Avatar
    John Michel

    Hi Christian

    A typical error is to use a QlmLicense object that's not completely initialized.

    You should always use the QlmLicense object of the LicenseValidator class.

    For example:

     

    LicenseValidator lv = new LicenseValidator();

    lv.QlmLicenseObject.GetProductProperties (....)

    If this does not help, I would need to take a look at your code. If you post code here, remember that this is a public forum so do not post anything confidential. You can also contact us at support@soraco.co.

  • Avatar
    Christian Franzen

    LicenseValidator is from the downloadable code examples and not part of the actual API right?

    I also believe the LicenseValidator class varies from example to example. Do know which example is meant to work with the GetProductProperties method?

    Anyway at this point we have rewritten the examples into an implementation that fits our needs. And therefor at this point have our own initialization of the license object.

    Can you please take a look at the following code example of our implementation and see if any thing sticks out:

     

    private QlmLicense CreateLicense(string computerID)
    {
      var license = new QlmLicense();
      license.DefineProduct(_productInfo.ProductID, _productInfo.ProductName, _productInfo.MajorVersion, _productInfo.MinorVersion, string.Empty, _productInfo.PersistanceKey);
      license.LicenseEngineLibrary = ELicenseEngineLibrary.DotNet;
      license.PublicKey = _productInfo.PublicKey;
      license.RsaPublicKey = _productInfo.RSAPublicKey;
      license.DefaultWebServiceUrl = "url to qlmservice.asmx";
      license.StoreKeysLocation = EStoreKeysTo.ERegistry;
      license.ValidateOnServer = false;
      license.PublishAnalytics = true;
      license.MaxDaysOffline = -1;
      license.MaxDaysOfflineTimerEnabled = false;
      license.ComputerID = computerID;
      license.CommunicationEncryptionKey = "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}";
      license.AdminEncryptionKey = "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}";
      return license;
    }

     

    Also, here is an example where I'm using the method above and trying to call GetProductProperties:

     

    var license = CreateLicense(computerID);
    var validateResult = license.ValidateLicenseEx(licenseKey, computerID);
    var licenseStatus = (int)license.GetStatus();
    string response;
    string props = license.GetProductProperties(license.DefaultWebServiceUrl, licenseKey, out response);

     

    Finally I forgot to mention that even though the string props is empty. I still get the following response:

     

    <?xml version="1.0" encoding="utf-8"?> <QuickLicenseManager><result>Successfully retrieved custom properties for Activation Key: XXXXXXXXXXXXXXXXXXXXXXXXXX</result> </QuickLicenseManager>

     

    Hope this might shed some light on the problem. I've tried to compare license settings with various code examples of the LicenseValidator class, but are unable to spot any issues. Hoping the information above might help you guys identify the problem.

    Let me know if you know of a solution or need other information from my end. Again any help is greatly apriciated.

     

  • Avatar
    John Michel

    The LicenseValidator class should be generated from the Protect Your Application wizard (3rd tab in the QLM Management Console).

    The code that you sent looks fine.

    One possibility is that your product definition was not published to the License Server. To publish:

    - Go to the Manage Keys tab

    - Click Sites then select your site

    - Click Upload products to the license server

     

    If this does not help, the next step would be to setup a screen sharing session to diagnose this with you.

    Please contact us at support@soraco.co to schedule a screen sharing session.

     

  • Avatar
    Christian Franzen

    I have figured it out!

    It turns out when calling GetProductProperties you need to use the original activation key.

    I was getting an empty result back, as I was calling the method with the pc key, generated when the license was activated.

    I was simply using the same pc key as when calling ValidateLicenseEx (you can even spot this in the code example I posted above if you look closely).

    So I know what to change now, to fix it. However, I was wondering if it is by design that the method success but returns an empty string when called with the pc-key insteand of the activation-key? I believe it might be a better design to either make it give an error about the key being of a wrong type, or just actually being able to use both activation- and pc-key.

    TLDR: Dont use the pc-key instead of the activation-key.

     

  • Avatar
    John Michel

    Glad you figured it out. Most APIs that communicate with the License Server require the ActiationKey as an argument to locate the record. Using the ComputerKey would be an option but would considerably slow down the operation.

Please sign in to leave a comment.

Powered by Zendesk