Check license programmatically

Hey Guys
I’m looking for way to check license by script, I need to check a license of 200 IS so do it by hand is a quite an issue

Many Thanks for any sugestion

Hi Marcin,

Can you please provide more information on what exactly you want to check through license file?

Thanks,
-Kalpesh.

just an expidation date and license key

You could use wm.server.query:getLicenseSettings, wm.server.query:getLicenseDetails services. Please note that standard caveat about utilizing WmRoot services applies here as well.

1 Like

Could you please send more details how to use this services ?

You would invoke these services as any other IS services. Please try invoking these service from Designer or Admin UI and you would get the details about the information that these services provides.

Regards,
-Kalpesh.

To make WmRoot visible on your Desinger package navigator, add the below setting on “Settings > Extended” (refersh designer) and use the serivce as suggested by other experts. Note, this is a internal service and might change anytime without prior notice or documentation hence use it at your own risk.

watt.server.ns.hideWmRoot=false

Any questions?

Try this Java service to retrieve license key and expiration date.


import com.wm.app.b2b.server.lic.ComponentInfo;
import com.wm.app.b2b.server.lic.KeyInfo;

		String licenseKey = null;
		String expirationDate = null;
		for (ComponentInfo componentInfo : KeyInfo.getComponentInfo()){
			if (componentInfo.getComponentName().equals("SalesInfo")){
				IDataCursor componentInfoCursor = componentInfo.getComponentInfo().getCursor();
				IData salesInfo = IDataUtil.getIData(componentInfoCursor, "Sales Information");
				componentInfoCursor.destroy();
				IDataCursor salesInfoCursor = salesInfo.getCursor();
				licenseKey = IDataUtil.getString(salesInfoCursor, "License Key");
				salesInfoCursor.destroy();
			}
			if (componentInfo.getComponentName().equals("ProductInfo")){
				IDataCursor componentInfoCursor = componentInfo.getComponentInfo().getCursor();
				IData productInfo = IDataUtil.getIData(componentInfoCursor, "Product Information");
				componentInfoCursor.destroy();
				IDataCursor productInfoCursor = productInfo.getCursor();
				expirationDate = IDataUtil.getString(productInfoCursor, "Expiration Date");
				productInfoCursor.destroy();
			}
		}
		
		IDataCursor pipelineCursor = pipeline.getCursor();
		IDataUtil.put(pipelineCursor, "licenseKey", licenseKey);
		IDataUtil.put(pipelineCursor, "expirationDate", expirationDate);
		pipelineCursor.destroy();