Phone sales support +39 0575 05077
  Phone technical support +39 0575 0508
 
Computing > 5 - Advanced License manipulation > List of the Licenses available for purchase

5.4 List of the Licenses available for purchase

Provides information on the licenses available for purchase.
By using the Aruba WsLicense method GetAvailableLicenses, it is possible to get the details on the licenses which the user can purchase.

Returns
The method returns an array of AvailablePleskLicense [] class items with the details on the licenses which can be purchased by the user with the relevant Addon licenses.
//IWsLicense.GetAvailableLicenses  Method (c# .NET)
private static string GetAvailableLicenses(WsLicenseClient client)
{
    //specify the account login details
    client.ClientCredentials.UserName.UserName = "ARU-0000";
    client.ClientCredentials.UserName.Password = "0123456789";

    //a StringBuilder class item is created
    StringBuilder sb = new StringBuilder();

    try
    {
        //call method GetAvailableLicenses,
        //obtaining a WsResultOfArrayOfAvailablePleskLicense item
        WsResultOfArrayOfAvailablePleskLicense result = client.GetAvailableLicenses();

        //if the call is not successful, re-run the error indicating the message
        if (result.Success)
        {
            sb.AppendLine("AvailableLicenses:");

            //browse the list of the licenses and print the values
            foreach (AvailablePleskLicense license in result.Value)
            {
                sb.AppendLine(String.Format("LicensePleskTypeID: {0}",
                    license.LicensePleskTypeID));
                sb.AppendLine(String.Format("LicenseDescription: {0}",
                    license.LicenseDescription));

                //browse the list of the Addon licenses and print the values
                foreach (AvailableAddonPleskLicense addon in license.AddonLicenses)
                {
                    sb.AppendLine(String.Format("... LicensePleskTypeAddonID: {0}",
                        addon.LicensePleskTypeAddonID));
                    sb.AppendLine(String.Format("... AddonDescription: {0}",
                        addon.AddonDescription));
                    sb.AppendLine(String.Format("... MinQuantity: {0}",
                        addon.MinQuantity));
                    sb.AppendLine(String.Format("... MaxQuantity: {0}",
                        addon.MaxQuantity));
                }
            }
        }
        else
        {
            throw new ApplicationException(result.ResultMessage);
        }
    }
    catch (Exception ex)
    {
        //re-run the generic error
        throw new ApplicationException(ex.Message);
    }

    return sb.ToString();
}
//IWsLicense.GetAvailableLicenses  Method (JAVA)
private static String GetAvailableLicenses(IWsLicense client)
{  
    //specify the account login details
    ((BindingProvider)client).getRequestContext()
            .put(BindingProvider.USERNAME_PROPERTY, "ARU-0000");	
    ((BindingProvider)client).getRequestContext()
            .put(BindingProvider.PASSWORD_PROPERTY, "0123456789");	

    //a StringBuilder class item is created
    StringBuilder sb = new StringBuilder();
    
    try
    {
        //call method getAvailableLicenses,
        //obtaining a WsResultOfArrayOfAvailablePleskLicense item
        WsResultOfArrayOfAvailablePleskLicense result = client.getAvailableLicenses();
        
        //if the call is not successful, re-run the error indicating the message
        if (result.isSuccess())
        {
            sb.append("AvailableLicenses:");
            
            //browse the list of the licenses and print the values
            for (AvailablePleskLicense license : 
                    result.getValue().getAvailablePleskLicense())
            {
                sb.append(String.format("LicensePleskTypeID: %d \n",
                    license.getLicensePleskTypeID()));
                sb.append(String.format("LicenseDescription: %s \n",
                    license.getLicenseDescription()));
                
                //browse the list of the Addon licenses and print the values
                for (AvailableAddonPleskLicense addon : 
                        license.getAddonLicenses().getAvailableAddonPleskLicense())
                {
                    sb.append(String.format("... LicensePleskTypeAddonID: %d \n",
                        addon.getLicensePleskTypeAddonID()));
                    sb.append(String.format("... AddonDescription: %s \n",
                        addon.getAddonDescription()));
                    sb.append(String.format("... MinQuantity: %d \n",
                        addon.getMinQuantity()));
                    sb.append(String.format("... MaxQuantity: %d \n",
                        addon.getMaxQuantity()));
                }
            }
        }
        else
        {
            throw new Exception(result.getResultMessage());
        }
    }
    catch (Exception ex)
    {
        //re-run the generic error
        System.out.println(ex.getMessage());
    }
    
    return sb.toString();
}
Version
API: v2.8 URL: https://api.dc1.computing.cloud.it/WsLicense/v2.8/WsLicense.svc?wsdl
See also

Version
API: v2.8 URL: https://api.dc1.computing.cloud.it/WsLicense/v2.8/WsLicense.svc?wsdl