This time I got a chance to play with inner world of Docusign. Always I prefer REST API but this time SOAP saved my life.
I had a challenge to combine all signed document in single enevelope ( condition is you can not get it through Docusign configs settings because that is common for) so I have used soap api this time over rest ( was giving me Time out error).
Required Data: Docusign Credential , Integrator Key & EnevelopId.
Firstly created a class 'DocusignSOAPfromWSDL_Cls' trough wsdl file then written our logic to get all document in combined format. Below is my code snippet:
// To Set endpoit URL
dsApiSend.endpoint_x = 'https://demo.docusign.net/api/3.0/dsapi.asmx';
// To Set Authentication
String auth = '<DocuSignCredentials>
<Username>'+ DocusignUserName+'</Username>
<Password>' + DocusignPassword + '</Password>
<IntegratorKey>' + Docusign_IntegratorKey + '</IntegratorKey> </DocuSignCredentials>';
// To Set Headers
dsApiSend.inputHttpHeaders_x = new Map<String, String>();
dsApiSend.inputHttpHeaders_x.put('X-DocuSign-Authentication',auth);
//Interating all incoming docusign status records
DocusignSOAPfromWSDL_Cls.EnvelopePDF combinedPDF = dsApiSend.RequestPDFNoWaterMark(docusignEnvelopeID);
Attachment combinedDocument = new attachment(
Body=EncodingUtil.base64Decode(combinedPDF.PDFBytes),
Name= AttachmentName+'.pdf',
parentId= ParentRecordId
);
insert combinedDocument ;
This is how you may combine all signed document through Docusign.
// To Set endpoit URL
dsApiSend.endpoint_x = 'https://demo.docusign.net/api/3.0/dsapi.asmx';
// To Set Authentication
String auth = '<DocuSignCredentials>
<Username>'+ DocusignUserName+'</Username>
<Password>' + DocusignPassword + '</Password>
<IntegratorKey>' + Docusign_IntegratorKey + '</IntegratorKey> </DocuSignCredentials>';
// To Set Headers
dsApiSend.inputHttpHeaders_x = new Map<String, String>();
dsApiSend.inputHttpHeaders_x.put('X-DocuSign-Authentication',auth);
//Interating all incoming docusign status records
DocusignSOAPfromWSDL_Cls.EnvelopePDF combinedPDF = dsApiSend.RequestPDFNoWaterMark(docusignEnvelopeID);
Attachment combinedDocument = new attachment(
Body=EncodingUtil.base64Decode(combinedPDF.PDFBytes),
Name= AttachmentName+'.pdf',
parentId= ParentRecordId
);
insert combinedDocument ;
This is how you may combine all signed document through Docusign.