'DocuSign JSON SOAP Request
I am trying to understand how to send SOAP requests with JSON formatted data to docusign. Following this guide is only for pdfs: https://developers.docusign.com/docs/esign-soap-api/how-to/request-signature/
I created a template on docusign developer and downloaded it, which is in json format.
- How do I send the data in that format? Is it currently stored as documentBase64, do I need to convert it the data to a PDF, or just set the documents bytes to that value (doc.PDFBytes)? Attempting to do the ladder, gives me a soap error:
Soap Fault: The validation of the PDF file failed.
- What fields are required to pull out of the json at minimum?
- Yes, I have the envelope, recipient and tabs set up. I currently am able to send PDFs as is to get signed, just not json formatted data.
Here is an example of attempting to pull out the documentbase64 data and set it to the pdfbytes field:
string pdfbytes = json4.value("documentBase64", "oops");
doc->PDFBytes = new xsd__base64Binary();
size_t pdfSize = 0;
// Double conversion to get it to match the datatype for *PDFBytes->ptr*
const unsigned char* t = reinterpret_cast<const unsigned char *>( pdfbytes.c_str() );
unsigned char* y = const_cast<unsigned char*>(t);
doc->PDFBytes->__ptr = y;
doc->PDFBytes->__size = pdfbytes.size();
UPDATE: Solved my own problem. You will need to decode your base64 data from docusign. I used the following decoder: https://renenyffenegger.ch/notes/development/Base64/Encoding-and-decoding-base-64-with-cpp/ Updated code:
string pdfbytes = json4.value("documentBase64", "oops");
std::string decoded = base64_decode(pdfbytes);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|