Common > Synchronize token with the device

    1.8 Synchronize token with the device

    By the method IWSCommon SyncToken you can Synchronizes the token for the provided username.

    Parameter
    optValue1
    Type: String
    OTP value returnde by the Aruba OTP Mobile App

    optValue2
    Type: String
    OTP value returnde by the Aruba OTP Mobile App

    /// IWsCommon.SyncToken Method (c# .NET)
    public static string SyncToken(WsCommonClient client, 
        String optValue1, String optValue2)
    {
        //specify the account login details 
        client.ClientCredentials.UserName.UserName = "ARU-0000";
        client.ClientCredentials.UserName.Password = "0123456789";
    
        StringBuilder stringBuilder = new StringBuilder();
    
        try
        {
            // call method SyncToken 
            // obtaining a WsResultOfboolean item
            WsResultOfboolean result =
                client.SyncToken(optValue1, optValue2);
    
            // if the call is Success print returned values
            if (result.Success)
            {
                stringBuilder.Append("Operation ends successfully\n");
    
                // get Value returned from server
                bool value = result.Value;
    
                stringBuilder.Append("\nReturned value: ");
                stringBuilder.Append(value);
    
            }
            else
            {
                throw new ApplicationException(result.ResultMessage);
            }
        }
        catch (Exception ex)
        {
            // re-run the error
            throw new ApplicationException(ex.Message);
        }
    
        return stringBuilder.ToString();
    }
    
    /// IWsCommon.SyncToken Method (JAVA)
    public static String SyncToken(IWsCommon client, 
        String optValue1, String optValue2)
    {
        //specify the account login details 
        //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 SyncToken 
            // obtaining a WsResultOfboolean item
            WsResultOfboolean result =
                client.syncToken(optValue1, optValue2);
    
            // if the call is Success print returned values
            if (result.isSuccess())
            {
                StringBuilder.append("Operation ends successfully\n");
    
                // get Value returned from server
                bool value = result.getValue();
    
                StringBuilder.append("\nReturned value: ");
                StringBuilder.append(value);
    
            }
            else
            {
                throw new Exception(result.getResultMessage());
            }
        }
        catch (Exception ex)
        {
            // re-run the error
            System.out.println(ex);
        }
    
        return StringBuilder.toString();
    }
    
    Version
    API: v2.7 URL:https://api.dc1.computing.cloud.it/WsCommon/v2.7/WsCommon.svc?wsdl