Phone sales support +39 0575 05077
  Phone technical support +39 0575 0508
 
Domains and DNS > 5 - Advanced DNS Management > Enable-Disable a DNS service

5.1 Enable-Disable a DNS service

By using the Aruba WsDNS method SetEnableDNS is possible to restore a previously disabled Dns Zone.
Parameters
DNSServiceID
Type: int
Value of type int with the DNS Service identifier.


    /// WsDns.SetEnableDNS Method (c# .NET)
    public static string SetEnableDNS(WsDNSClient client,
        int DNSServiceID)
    {
        //specify the account login details 
        client.ClientCredentials.UserName.UserName = "ARU-0000";
        client.ClientCredentials.UserName.Password = "0123456789";

        StringBuilder stringBuilder = new StringBuilder();

        try
        {
            // create the request object
            SetEnableDNSRequest request = new SetEnableDNSRequest();
            request.DNSServiceID =  DNSServiceID;

            // call method SetEnableDNS 
            // obtaining a WsResultOfDNSServiceResponse item
            WsResultOfDNSServiceResponse result = 
                client.SetEnableDNS(request); 

            //if the call is Success print value
            if (result.Success)
            {
                // get Value returned from server
                stringBuilder.Append("Operation end successfully.\n");
                stringBuilder.Append("\nJobID: ");
                stringBuilder.Append(result.Value.JobID);
                stringBuilder.Append("\nStatus : ");
                stringBuilder.Append(result.Value.Status);
            }
            else
            {
                throw new ApplicationException(result.ResultMessage);
            }
        }
        catch (Exception ex)
        {
            // re-run the error
            throw new ApplicationException(ex.Message);
        }

        return stringBuilder.ToString();
    }
    
/// WsDns.SetEnableDNS Method (JAVA)
public static String SetEnableDNS(IWsDNS client,
        int DNSServiceID) 
    {
    //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 {
        // create the request object
        SetEnableDNSRequest request = new SetEnableDNSRequest();
        request.setDNSServiceID(DNSServiceID);

        // call method SetEnableDNS 
        // obtaining a WsResultOfDNSServiceResponse item
        WsResultOfDNSServiceResponse result = client.setEnableDNS(request);

        //if the call is Success print value
        if (result.isSuccess()) {
            // get Value returned from server
            stringBuilder.append("Operation end successfully.\n");
            stringBuilder.append("\nJobID: ");
            stringBuilder.append(result.getValue().getJobID());
            stringBuilder.append("\nStatus : ");
            stringBuilder.append(result.getValue().getStatus());
        } else {
            throw new Exception(result.getResultMessage());
        }
    } catch (Exception ex) {
        //show error
        System.out.println(ex);
    }

    return stringBuilder.toString();
}
By using the Aruba WsDNS method SetDisableDNS is possible to Disable a Dns Zone owned by authenticartted user. An a record pointing to a courtesy page is set in the zone
Parameters
DNSServiceID
Type: int
Value of type int with the DNS Service identifier.


    /// WsDns.SetDisableDNS Method (c# .NET)
    public static string SetDisableDNS(WsDNSClient client,
        int DNSServiceID)
    {
        //specify the account login details 
        client.ClientCredentials.UserName.UserName = "ARU-0000";
        client.ClientCredentials.UserName.Password = "0123456789";

        StringBuilder stringBuilder = new StringBuilder();

        try
        {
            // create the request object
            SetDisableDNSRequest request = new SetDisableDNSRequest();
            request.DNSServiceID =  DNSServiceID;

            // call method SetDisableDNS 
            // obtaining a WsResultOfSetDisableDNSResponse item
            WsResultOfSetDisableDNSResponse result = 
                client.SetDisableDNS(request); 

            //if the call is Success print value
            if (result.Success)
            {
                // get Value returned from server
                stringBuilder.Append("Operation end successfully.\n");
                stringBuilder.Append("\nJobID: ");
                stringBuilder.Append(result.Value.JobID);
                stringBuilder.Append("\nStatus : ");
                stringBuilder.Append(result.Value.Status);
            }
            else
            {
                throw new ApplicationException(result.ResultMessage);
            }
        }
        catch (Exception ex)
        {
            // re-run the error
            throw new ApplicationException(ex.Message);
        }

        return stringBuilder.ToString();
    }
    
/// WsDns.SetDisableDNS Method (JAVA)
public static String SetDisableDNS(IWsDNS client,
        int DNSServiceID) 
    {
    //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 {
        // create the request object
        SetDisableDNSRequest request = new SetDisableDNSRequest();
        request.setDNSServiceID(DNSServiceID);

        // call method SetDisableDNS 
        // obtaining a WsResultOfSetDisableDNSResponse item
        WsResultOfSetDisableDNSResponse result = client.setDisableDNS(request);

        //if the call is Success print value
        if (result.isSuccess()) {
            // get Value returned from server
            stringBuilder.append("Operation end successfully.\n");
            stringBuilder.append("\nJobID: ");
            stringBuilder.append(result.getValue().getJobID());
            stringBuilder.append("\nStatus : ");
            stringBuilder.append(result.getValue().getStatus());
        } else {
            throw new Exception(result.getResultMessage());
        }
    } catch (Exception ex) {
        //show error
        System.out.println(ex);
    }

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