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.
Ensure that the Data tab in the top-right is active.
Click the + icon.
In the Entity field, search for and select UserManagementSubsystem.
In the Services field, type GetUserCount.
Beside the GetUserCount Service, click the right arrow.
Under Selected Services, check the box for Execute on Load.
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.
On the same Add Data pop-up, click the X beside UserManagementSubsystem to clear it.
In the Entity field, search for and select LicensingSubsystem.
In the Services field, type GetCurrentLicenseInfo.
Beside GetCurrentLicenseInfo, click the right arrow.
Under Selected Services on the GetCurrentLicenseInfo line, check the box for Execute on Load.
On the bottom-right of the pop-up, click Done.
At the top, click Save.
With our backend data now accessible, let's bind it to our Widgets for display.
On the Data tab, expand Subsystems_LicensingSubsystem > GetCurrentLicenseInfo > Returned Data.
Drag-and-drop Licensing's All Data onto the Grid Advanced Widget in the bottom section.
On the Select Binding Target pop-up, click Data.
Expand Subsystems_UserManagementSubsystem > GetUserCount > Returned Data > All Data.
Drag-and-drop User Management's result onto the Text Field Widget in the top section.
On the Select Binding Target pop-up, click Text.
At the top, click Save.
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.
In the top section of the Mashup, click the Auto Refresh Widget to select it.
On the top-left of the Auto Refresh Widget, click the drop-down icon to reveal additional options.
Drag-and-drop the Refresh Event onto GetCurrentLicenseInfo.
Repeat steps 1-3 to drag-and-drop the Refresh Event onto GetUserCount also.
With the Auto Refresh Widget still selected, browse the Properties section in the bottom-left.
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.
Click View Mashup.
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.
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.
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
Place the new .bin file into the appropriate folder and rename it to license_capability_response.bin.
In Foundation, navigate to the LicensingSubsystem > Services page.
On the AcquireLicense row, click the "play" icon for Execute Service.
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.
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:
License expiration count
Create a "License Dashboard" Mashup
Update to a new License
If you have questions, issues, or need additional information, refer to: