Domains and DNS > 4 - DNS Management > Purchase a DNS service

4.3 Purchase a DNS service

By using the Aruba WsDNS method SetPurchaseDNS authenticated user can purchase a Dns zone.
    /// WsDns.SetPurchaseDNS Method (c# .NET)
    public static string SetPurchaseDNS(WsDNSClient client,
        int topLevelDomainId, String domainName)
    {
        //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
            SetPurchaseDNSRequest request = new SetPurchaseDNSRequest();
            request.TopLevelDomainId = topLevelDomainId;
            request.DomainName = domainName;

            // call method SetPurchaseDNS 
            // obtaining a WsResultOfSetPurchaseDNSResponse item
            WsResultOfSetPurchaseDNSResponse result = 
                client.SetPurchaseDNS(request);

            //if the call is Success print value
            if (result.Success)
            {
                // get Value returned from server
                stringBuilder.Append("Operation ends 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.SetPurchaseDNS Method (JAVA)
public static String SetPurchaseDNS(IWsDNS client,
        int topLevelDomainId, String domainName) 
    {
    //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
        SetPurchaseDNSRequest request = new SetPurchaseDNSRequest();
        request.setTopLevelDomainId(topLevelDomainId);
        request.setDomainName(domainName);

        // call method SetPurchaseDNS 
        // obtaining a WsResultOfSetPurchaseDNSResponse item
        WsResultOfSetPurchaseDNSResponse result = client.setPurchaseDNS(request);

        //if the call is Success print value
        if (result.isSuccess()) {
            // get Value returned from server
            stringBuilder.append("Operation ends 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();
}
Versione
API: v2.8 URL:https://api.services.cloud.it/wsDns/v2.8/WsDns.svc?wsdl
See also