0
我们有一种情况,需要在两个单独的Docusign帐户中检查信封状态。如果我们没有得到第一个地位,我们想检查第二个。如何使用不同凭据重新初始化Docusign PHP API
我无法让API用我们的第二个帐户的凭据重新初始化。我用这个新变量调用这个片段:
require_once('docusign/SignatureApi.php');
$IntegratorsKey = "abcd";
$UserID = "[email protected]";
$Password = "xxxxx";
$_apiEndpoint = $Endpoint;
$_apiWsdl = "docusign/api/APIService.wsdl";
$api_options = array('location'=>$_apiEndpoint,'trace'=>true,'features' => SOAP_SINGLE_ELEMENT_ARRAYS);
$api = new APIService($_apiWsdl, $api_options);
$api->setCredentials("[" . $IntegratorsKey . "]" . $UserID, $Password);
$res = RequestEnvelopStatuses($envelopes);
$envelopeStatuses = $res->RequestStatusesResult;
if(!count($envelopeStatuses->EnvelopeStatuses->EnvelopeStatus)){
// If we did not find envelopes, check other account
$IntegratorsKey = "wxyz";
$UserID = "[email protected]";
$Password = "xxxxx";
$api->setCredentials("[" . $IntegratorsKey . "]" . $UserID, $Password);
// retry request
$res = RequestEnvelopStatuses($envelopes);
$envelopeStatuses = $res->RequestStatusesResult;
}
它不返回错误,但不会返回信封状态。它似乎仍然使用第一个凭据(猜测)。第二次尝试似乎总是返回任何第一次尝试。
有没有更好的/首选的方法来做到这一点?
你能展示更多的代码吗?显示第一个调用API,第二个导致你的麻烦 – 2015-02-09 22:10:16
@greg_diesel完成 – Fook 2015-02-09 22:34:45
你刚刚尝试实例化另一个对象而不是重复使用'$ api'? $ envelopepes定义在哪里?看起来如果你调用相同的'RequestEnvelopeStatuses'而不改变这个值,你会得到相同的结果? – 2015-02-09 22:42:56