“The operation has timed out” error when login via

2019-02-10 11:42发布

I'm getting the following error since 31/05/2018 from the DocuSign API on login.

DocuSign.eSign.Client.ApiException: 'Error calling Login: The operation has timed out'.

We have been testing DocuSign API since last year and it was all working fine with our in-house integrated application. Yesterday was the first time we got this error message in login and the issue is there still. If I login via the demo DocuSign web site https://appdemo.docusign.com, I can log in. But if I try the same via DocuSign API it gives the timeout error.

Configuration.ApiClient.Configuration.ApiClient.RestClient.BaseUrl is set to https://demo.docusign.net/restapi/

new System.Collections.Generic.Mscorlib_DictionaryDebugView<string, string>(Configuration.DefaultHeader).Items[0] is set to {[X-DocuSign-Authentication, {"Username":[username], "Password":[password], "IntegratorKey":[IntegratorKey]}]}

We haven't changed the username or password or IntegratorKey at all.

The value of response.StatusCode is returned as 0. Please find my code for login below.

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)));

    }

标签: docusignapi
1条回答
▲ chillily
2楼-- · 2019-02-10 12:40

DocuSign Support Website

For more details please read the link

enter image description here

Code Change

Please do this following changes (in red box) in your code.

Quick Fix

enter image description here

Code Line

  ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

Please ensure using System.Net; exists in your namespace.

查看更多
登录 后发表回答