0
votes

I have been using Docusign to embed signing in my UI using below PHP code. I have given correct credentials,

public function sign(){
                $username = "[email protected]";
                $password = "sample";
                $integrator_key = "1fsfd0658-zv95-4317-a016-d9f76eaasdff9";
                // DocuSign environment we are using
        $host = "https://demo.docusign.net/restapi";
        // create a new DocuSign configuration and assign host and header(s)
        $config = new \DocuSign\eSign\Configuration();
        $config->setHost($host);
        $config->addDefaultHeader("X-DocuSign-Authentication", "{\"Username\":\"" . $username . "\",\"Password\":\"" . $password . "\",\"IntegratorKey\":\"" . $integrator_key . "\"}");
        // instantiate a new docusign api client
        $apiClient = new \DocuSign\eSign\ApiClient($config);
        // we will first make the Login() call which exists in the AuthenticationApi...
        $authenticationApi = new \DocuSign\eSign\Api\AuthenticationApi($apiClient);
        // optional login parameters
        $options = new \DocuSign\eSign\Api\AuthenticationApi\LoginOptions();
        // call the login() API
            echo "djfnksd";
        $loginInformation = $authenticationApi->login($options);
        // parse the login results
        if(isset($loginInformation) && count($loginInformation) > 0)
        {
            // note: defaulting to first account found, user might be a 
            // member of multiple accounts
            $loginAccount = $loginInformation->getLoginAccounts()[0];
            if(isset($loginInformation))
            {
                $accountId = $loginAccount->getAccountId();
                if(!empty($accountId))
                {
                    echo "Account ID = $accountId\n";
                }
            }
        }
            }

But getting error when calling that method,

ApiException in ApiClient.php line 233: API call to https://demo.docusign.net/restapi/v2/login_information timed out:

{
    "url": "https:\/\/demo.docusign.net\/restapi\/v2\/login_information",
    "content_type": null,
    "http_code": 0,
    "header_size": 0,
    "request_size": 0,
    "filetime": -1,
    "ssl_verify_result": 1,
    "redirect_count": 0,
    "total_time": 1.046,
    "namelookup_time": 0.515,
    "connect_time": 0.78,
    "pretransfer_time": 0,
    "size_upload": 0,
    "size_download": 0,
    "speed_download": 0,
    "speed_upload": 0,
    "download_content_length": -1,
    "upload_content_length": -1,
    "starttransfer_time": 0,
    "redirect_time": 0,
    "redirect_url": "",
    "primary_ip": "162.248.186.25",
    "certinfo": [],
    "primary_port": 443,
    "local_ip": "192.168.1.12",
    "local_port": 53163
}

I'm clueless , what could be the possible error ?

1
To me it looks like login_information is the first actual API call intended to hit DocuSign in your code. My initial feeling is that whatever firewall you may be behind is blocking access to DocuSign, which is why you are timing out. Side note: you will want to generate a new integrator key, they are not meant to be advertised publicly. - Luis Scott
+1 on Luis' answer, your request is most likely getting blocked by a firewall or other security software on your side, never reaching DocuSign and therefore the request times out. Are you able to successfully use the REST API Explorer? If yes that points to firewall etc. - Ergin
yes i can , it works in rest api explorer. And i solved the problem by removing ssh verification in ApiClient.php it works fine. thanks - VivekParamasivam
Please do not add [solved] to titles here Vivek - we prefer answers simply to be accepted, as you already have done in this case. Thanks! - halfer

1 Answers

2
votes

It is working now. I solved the problem by removing ssh verification in ApiClient.php. By Commenting the below line

// disable SSL verification, if needed
   // if ($this->config->getSSLVerification() == false) {
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
    //}