CreateAndSendEnvelope is not working
-
20-12-2019 - |
Question
I am sending the envelope using SOAP API, https://demo.docusign.net/api/3.0/dsapi.asmx. I am writing the code in VB .NET. If I am sending the PDF file, I am getting Unspecified_Error from the webservice. If I am sending docx file, I am getting System was unable to convert this document to a PDF. Unable to convert Document(DocusignTestDoc.docx) to a PDF. Error: Could not submit Document to Conversion Server: EnvelopeId:00000000-0000-0000-0000-000000000000 DocumentName:DocusignTestDoc.docx - SubmitCode: -10242 error, coming back from API. I am not sure where to fix the issue. Here is my payload.
POST https://demo.docusign.net/api/3.0/dsapi.asmx HTTP/1.1
Content-Type: text/xml; charset=utf-8
X-DocuSign-Authentication: <DocuSignCredentials><Username>myemail@example.com</Username><Password>mypassword</Password><IntegratorKey>my integratorkey</IntegratorKey></DocuSignCredentials>
SOAPAction: "http://www.docusign.net/API/3.0/CreateAndSendEnvelope"
Host: demo.docusign.net
Content-Length: 17996
Expect: 100-continue
Accept-Encoding: gzip, deflate
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<CreateAndSendEnvelope xmlns="http://www.docusign.net/API/3.0">
<Envelope>
<AccountId>Account ID GUID</AccountId>
<Documents>
<Document>
<ID>1</ID>
<Name>DocusignTestDoc.docx</Name>
<PDFBytes>Something like this qAABkb2NQcm9wcy9hcHAueG1sUEsFBgAAAAAMAAwA/wIAAG0tAAAAAAA=</PDFBytes>
<FileExtension>.docx</FileExtension>
</Document>
</Documents>
<Recipients>
<Recipient>
<UserName>R1</UserName>
<Email>r1@yahoo.com</Email>
<Type>Signer</Type>
<AccessCode xsi:nil="true" />
</Recipient>
<Recipient>
<UserName>R2</UserName>
<Email>r2@gmail.com</Email>
<Type>Signer</Type>
<AccessCode xsi:nil="true" />
</Recipient>
</Recipients>
<Tabs>
<Tab>
<DocumentID>1</DocumentID>
<RecipientID>1</RecipientID>
<PageNumber>1</PageNumber>
<XPosition>350</XPosition>
<YPosition>350</YPosition>
<Type>Company</Type>
</Tab>
<Tab>
<DocumentID>1</DocumentID>
<RecipientID>1</RecipientID>
<PageNumber>1</PageNumber>
<XPosition>350</XPosition>
<YPosition>450</YPosition>
<Type>SignHere</Type>
</Tab>
<Tab>
<DocumentID>1</DocumentID>
<RecipientID>2</RecipientID>
<PageNumber>1</PageNumber>
<XPosition>350</XPosition>
<YPosition>550</YPosition>
<Type>SignHere</Type>
</Tab>
</Tabs>
<Subject>Test application</Subject>
<EmailBlurb>Hello, this is the test application for you to sign</EmailBlurb>
</Envelope>
</CreateAndSendEnvelope>
</s:Body>
</s:Envelope>
Please help me out and let me know if I am missing anything here. Thanks you so much.
Htwemay
Solution
First, try removing the .docx extension from the File Name value (<Name>) AND remove the period (.) from the File Extension value (<FileExtension>). When you do so, the <Document> portion of your request will look like this (for a .docx file):
<Document>
<ID>1</ID>
<Name>DocusignTestDoc</Name>
<PDFBytes>Something like this qAABkb2NQcm9wcy9hcHAueG1sUEsFBgAAAAAMAAwA/wIAAG0tAAAAAAA=</PDFBytes>
<FileExtension>docx</FileExtension>
</Document>
Or like this, if you're sending a PDF:
<Document>
<ID>1</ID>
<Name>DocusignTestDoc</Name>
<PDFBytes>Something like this qAABkb2NQcm9wcy9hcHAueG1sUEsFBgAAAAAMAAwA/wIAAG0tAAAAAAA=</PDFBytes>
<FileExtension>pdf</FileExtension>
</Document>
If you still receive an error, then I'd suggest doing the following to troubleshoot:
Verify that the file you're attempting to send (represented by <PDFBytes>) is indeed of the same file type as you specify for <FileExtension>. (I was able to repro the error you're getting by sending bytes for a PDF file but setting <FileExtension> to docx -- so an inaccurate file extension will certainly be problematic.)
Verify that the bytes you're sending in <PDFBytes> do indeed represent the full/accurate contents of the file.
Set aside the API momentarily and test if DocuSign's able to convert the file to PDF when you Create a new Envelope via the DocuSign web console and upload the file. If you're able to successfully upload the file to a new Envelope via the DocuSign UI (web console), then this proves that the file is valid (i.e., not corrupt) it's likely that your issue lies with either #1 or #2 above.