Ошибка «Операция истекла» при входе через DocuSign API в C # - PullRequest
0 голосов
/ 01 июня 2018

Я получаю следующую ошибку с 31/05/2018 из API DocuSign при входе в систему.

DocuSign.eSign.Client.ApiException: 'Ошибка при входе в систему: истекло время ожидания операции'.

Мы тестировали API DocuSign с прошлого года, и все это прекрасно работало с нашим собственным интегрированным приложением.Вчера мы впервые получили это сообщение об ошибке при входе в систему, и проблема все еще существует.Если я войду через демонстрационный веб-сайт DocuSign https://appdemo.docusign.com,, я смогу войти в систему. Но если я попробую то же самое через DocuSign API, это выдаст ошибку времени ожидания.

Configuration.ApiClient.Configuration.ApiClient.RestClient.BaseUrl установлен на https://demo.docusign.net/restapi/

new System.Collections.Generic.Mscorlib_DictionaryDebugView<string, string>(Configuration.DefaultHeader).Items[0] установлено на {[X-DocuSign-Authentication, {"Username":[username], "Password":[password], "IntegratorKey":[IntegratorKey]}]}

Мы не изменили имя пользователя, пароль или IntegratorKey вообще.

Значение response.StatusCode возвращается как 0. Пожалуйста, найдите мой код для входа в систему ниже.

public ApiResponse< LoginInformation > LoginWithHttpInfo (AuthenticationApi.LoginOptions options = null)
    {            

        var path_ = "/v2/login_information";

        var pathParams = new Dictionary<String, String>();
        var queryParams = new Dictionary<String, String>();
        var headerParams = new Dictionary<String, String>(Configuration.DefaultHeader);
        var formParams = new Dictionary<String, String>();
        var fileParams = new Dictionary<String, FileParameter>();
        Object postBody = null;

        // to determine the Content-Type header
        String[] httpContentTypes = new String[] {

        };
        String httpContentType = Configuration.ApiClient.SelectHeaderContentType(httpContentTypes);

        // to determine the Accept header
        String[] httpHeaderAccepts = new String[] {
            "application/json"
        };
        String httpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(httpHeaderAccepts);
        if (httpHeaderAccept != null)
            headerParams.Add("Accept", httpHeaderAccept);

        // set "format" to json by default
        // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
        pathParams.Add("format", "json");


        if (options != null)
        {
            if (options.apiPassword != null) queryParams.Add("api_password", Configuration.ApiClient.ParameterToString(options.apiPassword)); // query parameter
            if (options.includeAccountIdGuid != null) queryParams.Add("include_account_id_guid", Configuration.ApiClient.ParameterToString(options.includeAccountIdGuid)); // query parameter
            if (options.loginSettings != null) queryParams.Add("login_settings", Configuration.ApiClient.ParameterToString(options.loginSettings)); // query parameter

        }


        // make the HTTP request
        IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(path_, 
            Method.GET, queryParams, postBody, headerParams, formParams, fileParams,
            pathParams, httpContentType);

        int statusCode = (int) response.StatusCode;

        if (statusCode >= 400)
            throw new ApiException (statusCode, "Error calling Login: " + response.Content, response.Content);
        else if (statusCode == 0)
            throw new ApiException (statusCode, "Error calling Login: " + response.ErrorMessage, response.ErrorMessage);

        return new ApiResponse<LoginInformation>(statusCode,
            response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
            (LoginInformation) Configuration.ApiClient.Deserialize(response, typeof(LoginInformation)));

    }

1 Ответ

0 голосов
/ 01 июня 2018

Веб-сайт поддержки DocuSign

Для получения более подробной информации, пожалуйста, прочитайте ссылку

enter image description here

Изменение кода

Выполните следующие изменения (в красном поле) в вашем коде.

Быстрое исправление

enter image description here

Кодовая строка

  ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

Убедитесь, что using System.Net; существует в вашем пространстве имен.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...