DocuSign集成遇NO_DOCUMENT_RECEIVED错误:动态文档方案故障求助
集成DocuSign签署功能时的404错误排查求助
调用DocuSign接口时触发404错误:
"NO_DOCUMENT_RECEIVED": "The document element did not contain the encoded document, 'documentId='possibly missing from Content-Disposition header."
应用需要支持用户选择待签署文档,目前实现了两种方案,一种可行一种不可行,希望修复动态获取文档的方案。
不可行方案(动态从数据库获取文档路径)
通过$args["doccontent"]获取PDF路径后处理,代码如下:
$doc_internal_name = str_replace("http://127.0.0.1:8000/","C:/laragon2/www/ApplicationNAme/public/",$args['doccontent']); $doc_content = file_get_contents($doc_internal_name ); $base64FileContent = base64_encode($doc_content); $document = new Document( [ 'document_base64' => $base64FileContent, 'name' => 'testdoc', 'file_extension' => "pdf", 'document_id' => 1 ] ); /* Create the signer recipient model */ $signer = new \DocuSign\eSign\Model\Signer([ 'email' => email, 'name' => name , 'recipient_id' => '1', 'routing_order' => '1', 'client_user_id' => $args['signer_client_id'] ]); /* Create a signHere tab (field on the document) */ $signHere = new \DocuSign\eSign\Model\SignHere([ 'anchor_string' => '/sn1/', 'anchor_units' => 'pixels', 'anchor_y_offset' => '10', 'anchor_x_offset' => '20' ]); /* Create a signHere 2 tab (field on the document) */ $signHere2 = new \DocuSign\eSign\Model\SignHere([ 'anchor_string' => '/sn2/', 'anchor_units' => 'pixels', 'anchor_y_offset' => '40', 'anchor_x_offset' => '40' ]); $signer->settabs(new \DocuSign\eSign\Model\Tabs(['sign_here_tabs' => [$signHere, $signHere2]])); $envelopeDefinition = new \DocuSign\eSign\Model\EnvelopeDefinition([ 'email_subject' => "Please sign this document", 'documents' => [$document], 'recipients' => new \DocuSign\eSign\Model\Recipients(['signers' => [$signer]]), ]); return $envelopeDefinition;
可行方案(硬编码本地文档路径)
直接使用同一文档的本地路径,代码如下:
$content = file_get_contents("../public/uploads/zbD0nVz3NoEYjg2ttHnrhoJ7JM7OQbqSVQCnNT8U.pdf"); $base64FileContent = base64_encode($content); $document = new Document( [ 'document_base64' => $base64FileContent, 'name' => 'test', 'file_extension' => 'pdf', 'document_id' => 1 ] ); /* Create the signer recipient model */ $signer = new \DocuSign\eSign\Model\Signer([ 'email' => email, 'name' => name , 'recipient_id' => '1', 'routing_order' => '1', 'client_user_id' => $args['signer_client_id'] ]); /* Create a signHere tab (field on the document) */ $signHere = new \DocuSign\eSign\Model\SignHere([ 'anchor_string' => '/sn1/', 'anchor_units' => 'pixels', 'anchor_y_offset' => '10', 'anchor_x_offset' => '20' ]); /* Create a signHere 2 tab (field on the document) */ $signHere2 = new \DocuSign\eSign\Model\SignHere([ 'anchor_string' => '/sn2/', 'anchor_units' => 'pixels', 'anchor_y_offset' => '40', 'anchor_x_offset' => '40' ]); $signer->settabs(new \DocuSign\eSign\Model\Tabs(['sign_here_tabs' => [$signHere, $signHere2]])); $envelopeDefinition = new \DocuSign\eSign\Model\EnvelopeDefinition([ 'email_subject' => "Please sign this document", 'documents' => [$document], 'recipients' => new \DocuSign\eSign\Model\Recipients(['signers' => [$signer]]), ]); return $envelopeDefinition;
希望各位提供排查思路,修复动态获取文档的方案,支持不同用户签署不同文档。
内容的提问来源于stack exchange,提问作者user16795407
相关产品推荐
相关产品推荐

