cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Manage Licensing with Foundation Subsystems Part 2

No ratings

 

Step 5: Add Data

 

Now that our Mashup's Layout and Widgets have been set, we need to bring in backend data and tie it to those Widgets for display. 

 

We'll make use of Mashup Data Services for this. The first one we'll add will be UserManagementSubsystem > GetUserCount.

 

  1. Ensure that the Data tab in the top-right is active.

    31-lsub-data.png

     

  2. Click the + icon.

    32-lsub-add-data.png

     

  3. In the Entity field, search for and select UserManagementSubsystem.

    33-lsub-usermgmt-entity.png

     

  4. In the Services field, type GetUserCount.

    34-lsub-usermgmt-service.png

     

  5. Beside the GetUserCount Service, click the right arrow.
  6. Under Selected Services, check the box for Execute on Load.

    35-lsub-usermgmt-selectedservices.png

     

 

Add LicensingSubsystem > GetCurrentLicenseInfo

 

You're not limited to only pulling information from one Mashup Data Service.

 

We already have User Management's GetUserCount. We'll now also bring in information from the Licensing Subsystem.

 

  1. On the same Add Data pop-up, click the X beside UserManagementSubsystem to clear it.

    36-lsub-clear-entity.png

     

  2. In the Entity field, search for and select LicensingSubsystem.

    37-lsub-licensing-entity.png

     

  3. In the Services field, type GetCurrentLicenseInfo.

    38-lsub-licensing-service.png

     

  4. Beside GetCurrentLicenseInfo, click the right arrow.
  5. Under Selected Services on the GetCurrentLicenseInfo line, check the box for Execute on Load.

    39-lsub-licensing-selectedservices.png

     

  6. On the bottom-right of the pop-up, click Done.

    40-lsub-data-done.png

     

  7. At the top, click Save.

 

Bind Data

 

With our backend data now accessible, let's bind it to our Widgets for display.

 

  1. On the Data tab, expand Subsystems_LicensingSubsystem > GetCurrentLicenseInfo > Returned Data.

    41-lsub-expand-licensing.png

     

  2. Drag-and-drop Licensing's All Data onto the Grid Advanced Widget in the bottom section.

    42-lsub-drag-drop-license-data.png

     

  3. On the Select Binding Target pop-up, click Data.

    43-lsub-grid-bind-data.png

     

  4. Expand Subsystems_UserManagementSubsystem > GetUserCount > Returned Data > All Data.

    44-lsub-expand-usermgmt.png

     

  5. Drag-and-drop User Management's result onto the Text Field Widget in the top section.

    45-lsub-drag-drop-user-text.png

     

  6. On the Select Binding Target pop-up, click Text.

    46-lsub-text-bind-data.png

     

  7. At the top, click Save.

 

Automatically Refresh

 

If we were to click View Mashup now, we would see the User Count and Licensing info displayed in the Mashup's Widgets. However, it would never update unless we manually refreshed the page.

 

To automate that process, we'll use the Auto Refresh Widget.

 

  1. In the top section of the Mashup, click the Auto Refresh Widget to select it.

    47-lsub-select-refresh.png

     

  2. On the top-left of the Auto Refresh Widget, click the drop-down icon to reveal additional options.
    48-lsub-refresh-options.png

     

  3. Drag-and-drop the Refresh Event onto GetCurrentLicenseInfo.

    49-lsub-drag-drop-refresh-license.png

     

  4. Repeat steps 1-3 to drag-and-drop the Refresh Event onto GetUserCount also.

    50-lsub-drag-drop-refresh-usermgmt.png

     

  5. With the Auto Refresh Widget still selected, browse the Properties section in the bottom-left.

    51-lsub-refresh-properties.png

     

  6. Change RefreshInterval to 5, and hit your keyboard's Tab key to lock in the change.
    • This will cause the Refresh Event to fire every 5 seconds.

    52-lsub-refresh-interval.png

     

  7. Click Save.
  8. Click View Mashup.

    53-lsub-view-mashup.png

     

 

Step 6: Replace License

 

We have now created a Minimum Viable Product (MVP) of a "licensing dashboard" to ease our administration work.

 

This dashboard could still be improved. For instance, a Mashup Function could be created which automatically recalculates the value from GetUserCount to more accurately match GetCurrentLicenseInfo. This can be accomplished via the Mashup Builder's bottom-right Functions tab. Or, you could even add a separate Text Field Widget to to the top section and directly access the remaining license time via the LicensingSubsystem > GetDaysRemainingInLicense Service. 

 

Whatever you choose to do to improve the Mashup is up to you.

 

However, what should be done when a license is nearing its expiration? To resolve this issue, we need to replace the existing license via the AcquireLicense Service.

 

  1. Within the OS of the Foundation server, navigate to the file-system folder where the current license_capability_response.bin is located.
    • This is typically the ThingworxPlatform folder.

     

  2. Move the existing license_capability_response.bin and any other existing *.bin files to another location for backup.
    • Note that this is EXTREMELY important, as if anything goes wrong, you want to be able to restore the original license.
    • It is very important to ensure that only one *.bin file exists in the appropriate folder

  3. Place the new .bin file into the appropriate folder and rename it to license_capability_response.bin.

  4. In Foundation, navigate to the LicensingSubsystem > Services page.

    56-lsub-licensing-services.png

     

  5. On the AcquireLicense row, click the "play" icon for Execute Service.

    57-lsub-acquirelicense.png

     

  6. On the bottom-right of the pop-up, click Execute.
    • Note that if you receive an error, it will be necessary to restart the ThingWorx Tomcat service.  The act of restarting the service will automatically load the new license.

     

  7. To close the pop-up, click Done.

 

After acquiring your new license, you should immediately return to the LicensingSubsystem and consult the GetCurrentLicenseInfo Service to confirm that Thing, User, expiration-date, and other issues are accurate.

 

If anything goes wrong with the new license transfer, you can simply replace the original license_capability_response.bin file and re-run AcquireLicense to return to your old one. Once again, it is import to perform these steps well before your expiration occurs. 

 

Foundation checks for a valid license periodically. If this happens while you have an invalid license_capability_response.bin file in-place, you will no longer be able to access the Foundation GUI. 

 

Fortunately, these issues are self-correcting if a valid license_capability_response.bin is placed in the correct location, as these periodic checks will also pick up a valid license_capability_response.bin file automatically, even after the system has locked you out. 

 

You should also be able to trigger an AcquireLicense action via a REST call even if the GUI is unavailable. 

 

 

Step 7: Next Steps

 

Congratulations! You've successfully completed the Manage Licensing with Foundation Subsystems guide.

 

In this guide, you learned how to:

 

  • Access the Foundation Subsystems
  • Execute built-in Services to retrieve:
    • User counts
    • Thing counts
    • License expiration count
  • Create a "License Dashboard" Mashup
  • Update to a new License 

 

Additional Resources

 

If you have questions, issues, or need additional information, refer to:

 

 Resource       Link
CommunityDeveloper Community Forum
SupportFoundation Help Center

 

Version history
Last update:
‎Oct 26, 2022 03:02 PM
Updated by:
Labels (1)
Contributors