作为测试的一部分,我们正在尝试在生产环境中设置Docusign rest api。通过我们的staging和其他测试服务器连接到api不需要特殊配置。然而,当在我们的生产服务器上尝试相同的代码时,我不断遇到以下错误:
这是sdk/docusign php client master/src/ApiClient.php第227行附近的输出(api参考https://docs.docusign.com/esign/)
[DEBUG] HTTP Request body ~BEGIN~
~END~
[DEBUG] HTTP Response body ~BEGIN~
~END~
* Hostname was NOT found in DNS cache
* Trying 162.248.184.25...
* Connected to demo.docusign.net (162.248.184.25) port 443 (#0)
* successfully set certificate verify locations:
* CAfile: /etc/php5/cacert.pem
CApath: /etc/ssl/certs/
* SSL certificate problem: unable to get local issuer certificate
* Closing connection 0
Exception: exception 'DocuSigneSignApiException' with message 'API call to https://demo.docusign.net/restapi/v2/login_information timed out: a:26:{s:3:"url";s:54:"https://demo.docusign.net/restapi/v2/login_information";s:12:"content_type";N;s:9:"http_code";i:0;s:11:"header_size";i:0;s:12:"request_size";i:0;s:8:"filetime";i:-1;s:17:"ssl_verify_result";i:1;s:14:"redirect_count";i:0;s:10:"total_time";d:0.67847199999999996;s:15:"namelookup_time";d:0.50941599999999998;s:12:"connect_time";d:0.59162199999999998;s:16:"pretransfer_time";d:0;s:11:"size_upload";d:0;s:13:"size_download";d:0;s:14:"speed_download";d:0;s:12:"speed_upload";d:0;s:23:"download_content_length";d:-1;s:21:"upload_content_length";d:-1;s:18:"starttransfer_time";d:0;s:13:"redirect_time";d:0;s:12:"redirect_url";s:0:"";s:10:"primary_ip";s:14:"162.248.184.25";s:8:"certinfo";a:0:{}s:12:"primary_port";i:443;s:8:"local_ip";s:14:"10.231.215.217";s:10:"local_port";i:38425;}' in /srv/www/vhosts/server.name.com/pages/test/docusign/sdk/docusign-php-client-master/src/ApiClient.php:233
Stack trace:
#0 /srv/www/vhosts/server.name.com/pages/test/docusign/sdk/docusign-php-client-master/src/Api/AuthenticationApi.php(264): DocuSigneSignApiClient->callApi('/v2/login_infor...', 'GET', Array, '', Array, 'DocuSigneSign...')
**#1 /srv/www/vhosts/server.name.com/pages/test/docusign/sdk/docusign-php-client-master/src/Api/AuthenticationApi.php(193): DocuSigneSignApiAuthenticationApi->loginWithHttpInfo(Object(DocuSigneSignApiAuthenticationApiLoginOptions))
#2 /srv/www/vhosts/server.name.com/pages/test/docusign/docusign_wrapper.php(58): DocuSigneSignApiAuthenticationApi->login(Object(DocuSigneSignApiAuthenticationApiLoginOptions))
#3 /srv/www/vhosts/server.name.com/pages/test/docusign/docusign_wrapper.php(52): DocuSignWrapper->doLogin()
#4 /srv/www/vhosts/server.name.com/pages/test/docusign/classtest.php(130): DocuSignWrapper->__construct()
#5**
至于SSL证书。我想这可能就是问题所在。它的报告方式与我们的其他服务器不同,后者将CAfile值留空。我不知道这是在哪里配置的。只有/etc/php5/apache2/php.ini定义了文件位置。然而php--ini揭示了这不是一个用于配置php的.ini文件。删除设置似乎没有任何效果。它可能需要重新启动apache2,但我还没有机会关闭服务器。
字符串"etc/php5"也不会出现在代码库中的任何位置,因此它不是手动设置的。文件/etc/php5/cacert.pem存在,并且是https://curl.haxx.se/ca/cacert.pem
如果我错了,请纠正我,但我无法手动设置"CAfile"的值,因为它似乎不是我可以访问的设置。
设置详细信息:
生产服务器:
SUSE Linux Enterprise Server 12 (x86_64)
PHP 5.5.14
cURL:
[version] => 7.37.0
[ssl_version] => OpenSSL/1.0.1i
暂存服务器:
临时服务器成功连接(部分)的示例
* Hostname was found in DNS cache
* Hostname in DNS cache was stale, zapped
* Trying 162.248.184.25...
* Connected to demo.docusign.net (162.248.184.25) port 443 (#2)
* successfully set certificate verify locations:
* CAfile: none
CApath: /etc/ssl/certs/
服务器详细信息:
openSUSE Leap 42.1 (x86_64)
PHP 5.5.14
cURL:
[version] => 7.37.0
[ssl_version] => OpenSSL/1.0.1i
这很可能是客户端SSL证书的问题,而不是DocuSign服务器端的问题。我将研究以前关于PHP和SSL证书的相关问题,例如:
curl:(60)SSL证书:无法获取本地颁发者证书
您也可以尝试使用带有-k
选项的cUrl来发送不安全的请求(用于测试)。DocuSign的演示环境还通过http
接受请求,而不是仅通过https
接受请求,因此您可能也需要对此进行测试。
$this->config = new Configuration();
$this->config->setHost($this->args['base_path']);
$this->config->setSslVerification(false); //this worked for me