通过C#中的DocuSign api登录时"操作已超时"错误

Dee*_*thi 5 docusignapi

我从登录时的DocuSign API收到以下错误,自31/05/2018起.

DocuSign.eSign.Client.ApiException:'调用登录时出错:操作已超时'.

自去年以来,我们一直在测试DocuSign API,它与我们的内部集成应用程序一起正常运行.昨天是我们第一次在登录时收到此错误消息,问题仍然存在.如果我通过演示版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)));

    }
Run Code Online (Sandbox Code Playgroud)

Rag*_*h S 5

DocuSign支持网站

有关详细信息,请阅读链接

在此输入图像描述

代码变更

请在代码中进行更改(红色框)后执行此操作.

快速解决

在此输入图像描述

代码行

  ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
Run Code Online (Sandbox Code Playgroud)

请确保using System.Net;您的命名空间中存在.