Monitoring > 2 - Management Monitoring Services > Get Monitoring Services

2.1 Get Monitoring Services


By the method GetMonitoringServices you can retrieve the list of monitoring Services purchased.
/// WsMonitoring.GetMonitoringServices Method (c# .NET)
public static string GetMonitoringServices(WsMonitoringClient client)
{
    //specify the account login details 
    client.ClientCredentials.UserName.UserName = "ARU-0000";
    client.ClientCredentials.UserName.Password = "0123456789";

    StringBuilder stringBuilder = new StringBuilder();

    try
    {
 // call method GetMonitoringServices 
 // obtaining a WsResultOfArrayOfMonitoringServiceEntity item
 WsResultOfArrayOfMonitoringServiceEntity result =
     client.GetMonitoringServices();

 // if the call is Success print returned values
 if (result.Success)
 {
     stringBuilder.Append("Operation ends successfully\n");

     // get Value returned from server
     MonitoringServiceEntity[] items = result.Value;

     // for each item print the information
     foreach (MonitoringServiceEntity item in items)
     {
  stringBuilder.Append("\nMonitoringServiceID: ");
  stringBuilder.Append(item.MonitoringServiceID);
     }
 }
 else
 {
     throw new ApplicationException(result.ResultMessage);
 }
    }
    catch (Exception ex)
    {
 // re-run the error
 throw new ApplicationException(ex.Message);
    }

    return stringBuilder.ToString();
}
/// WsMonitoring.GetMonitoringServices Method (JAVA)
public static String GetMonitoringServices(IWsMonitoring client) 
{
    //specify the account login details 
    ((BindingProvider) client).getRequestContext()
 .put(BindingProvider.USERNAME_PROPERTY, "ARU-0000");
    ((BindingProvider) client).getRequestContext()
 .put(BindingProvider.PASSWORD_PROPERTY, "0123456789");

    StringBuilder stringBuilder = new StringBuilder();

    try 
    {
        // call method GetMonitoringServices 
        // obtaining a WsResultOfArrayOfMonitoringServiceEntity item
        WsResultOfArrayOfMonitoringServiceEntity result =
            client.getMonitoringServices();

        //if the call is Success print values
        if (result.isSuccess()) 
     {
     ArrayOfMonitoringServiceEntity items = result.getValue(); 
     List monitoringServiceEntity = 
  items.getMonitoringServiceEntity();
 
     for (Iterator it = 
  monitoringServiceEntity.iterator(); it.hasNext();)
     {
         MonitoringServiceEntity item = it.next();
         stringBuilder.append("\nMonitoringServiceID: ");
         stringBuilder.append(item.getMonitoringServiceID());
     }
        } 
 else 
 {
     throw new Exception(result.getResultMessage());
        }
    } 
    catch (Exception ex) 
    {
        System.out.println(ex);
    }

return stringBuilder.toString();
}
Version
API: v2.8 URL:https://api.services.cloud.it/wsMonitoring/v2.8/wsMonitoring.svc?wsdl
See also