我试图了解如何使用JSON格式化数据发送肥皂请求将其发送到DocuSign。遵循本指南仅适用于PDF:
我在docusign开发人员上创建了一个模板,并下载了它,即JSON格式。
- 如何以这种格式发送数据?它是当前存储为DocumentBase64吗?我是否需要将数据转换为PDF,还是将文档字节设置为该值(doc.pdfbytes)?试图做梯子,给我一个肥皂错误:
SOAP故障:PDF文件的验证失败。
- 最少从JSON退出需要哪些字段?
- 是的,我设置了信封,收件人和选项卡。目前,我可以按照签名来发送PDF,而不是JSON格式化的数据。
这是试图提取DocumentBase64数据并将其设置为PDFBYTES字段的示例:
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();
更新:
解决了我自己的问题。您将需要从DocuSign解码BASE64数据。我使用以下解码器:
更新的代码:
string pdfbytes = json4.value("documentBase64", "oops");
std::string decoded = base64_decode(pdfbytes);
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);
发布评论
评论(1)
除非您有充分的理由,否则我强烈建议您考虑使用 docuSign 而不是 docusign eSignature soap api api 。
并非每个功能都由SOAP API支持。
您可以使用 https://github.com/jgaa/restc-cpp 来自C ++代码库的调用。
另外,请记住,API中发送的文档必须是基本64编码。这是用于休息和肥皂的。
Unless you have a really good reason, I highly recommend you consider using the DocuSign eSignature REST API and not the DocuSign eSignature SOAP API.
Not every feature is supported by the SOAP API.
You could use https://github.com/jgaa/restc-cpp to make REST API calls from a C++ codebase.
Also, remember that documents sent in the API has to be base64 encoded. This goes for both REST and SOAP.