2016-03-16 161 views
1

我遇到连接问题演示API
https://demo.docusign.net/restapi
要连接我使用下面提供的代码,API。它适用于我的美国同事,但是当我尝试从立陶宛连线时,零响应。

难道那里有任何位置限制,或者我错过了什么?
它应该是防火墙的一些细节(我在NAT下)?
我的本地php/http服务器需要一些特定的配置吗?的DocuSign API连接

$email = "some email @ fsdfdsf"; 
$integratorKey = "TEST-xxxxxxxxxxx"; 
$password = "some password"; 

$url = "https://demo.docusign.net/restapi/v2/login_information?include_account_id_guid=true"; 
$header = "<DocuSignCredentials><Username>" . $email . "</Username><Password>" . $password . "</Password><IntegratorKey>" . $integratorKey . "</IntegratorKey></DocuSignCredentials>"; 

$curl = curl_init($url); 
curl_setopt($curl, CURLOPT_HEADER, false); 
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 
curl_setopt($curl, CURLOPT_HTTPHEADER, array("X-DocuSign-Authentication: $header")); 
$json_response = curl_exec($curl); 
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE); 

if($status==200){ 
    $response = json_decode($json_response, true); 
    print_r(json_encode($response['loginAccounts'][0])); 
}else{ 
    print_r($json_response); 
} 
+0

这当然是可能是您的防火墙阻止访问。你收到了什么HTTP错误? FYI DocuSign IP范围(如果您需要更新FW规则),请访问:https://trust.docusign.com/en-us/trust-certifications/ip-ranges/ –

+0

我能够获得登录响应通过REST客户端。但如何通过PHP获得回应,我愿意使用php docusign客户端v2 – Vid

+0

我在通过API登录时收到错误,并且在unittest中发生的错误是相同的。有部分错误信息:
有1个错误: 1)UnitTests :: testLogin DocuSign \ eSign \ ApiException:API调用https://demo.docusign.net/restapi/v2/login_information超时: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:1 .............. :”162.248.186.25“; s:8:”certinfo“; a:0:{} s:12: “prim ary_port”; i:443; s:8:“local_ip”; s:13:“192.168.1.126”; s:10:“local_port”; i:38635;} C:\ xampp \ htdocs \ localbits \ ds \ docusign \ src \ ApiClient.php:233 – Vid

回答

1

我发现了一个停止工作的源代码。 在我的本地服务器上ssl没有签名。 那么简单,只在测试环境中快速修复可能是关闭SSL上的卷曲检查:

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 

或得到签名SSL sertificate。

0

DocuSign不对API客户端实施任何位置限制。

您可以通过尝试使用Web浏览器中的服务来检查您的防火墙是否允许连接到DocuSign。尝试demo.docusign.net

您也可以使用浏览器来directly access a method in the API server that provides information on the API service points.

如果一切正常,那么你知道问题出在你的API代码。 如果是这样,请首先尝试API recipes之一。

如果您无法访问Web服务,请检查您的防火墙设置。

+0

我找到baseUrl,但我无法访问它,是否需要提出请求https://demo.docusign.net/restapi/v2/accounts/XXX/envelopes/ acdf93aa-f1f1-4ba0-a6f6-8883c6d20251/documents/1 – FosAvance

+0

正确。在开始时记住https://。 –

+0

有没有办法从DocuSign的PHP库中检索文档? – FosAvance

1

这是我如何解决它,我加$config->setSSLVerification(false); TU关闭SSL验证

$username = "[email protected]"; 
$password = "XXX"; 
$integrator_key = "some_key";  

// change to production before going live 
//https://www.docusign.net/restapi 
//https://www.docusign.com/p/RESTAPIGuide/Content/GettingStarted/REST%20API%20Version.htm 
$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->setSSLVerification(false); 
$config->addDefaultHeader("X-DocuSign-Authentication", "{\"Username\":\"" . $username . "\",\"Password\":\"" . $password . "\",\"IntegratorKey\":\"" . $integrator_key . "\"}"); 
// instantiate a new docusign api client 
$apiClient = new \DocuSign\eSign\ApiClient($config);