首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >DocuSign VBA错误400 errorCode: ENVELOPE_IS_INCOMPLETE

DocuSign VBA错误400 errorCode: ENVELOPE_IS_INCOMPLETE
EN

Stack Overflow用户
提问于 2015-10-14 21:32:40
回答 1查看 471关注 0票数 0

如果您能够理解.setRequestHeader设置对此错误的影响,您将非常感激。

代码语言:javascript
复制
Public Sub SignatureReq()
Dim httpRequest As MSXML2.XMLHTTP60

' defined request and result variables
Set httpRequest = New XMLHTTP60

' define the new URL for the signature request using the Base URL returned aboved appended with '/envelopes'
Dim sigURL As String
sigURL = URLBase & "/envelopes"
' currently sig URL is 'https://demo.docusign.net/restapi/v2/accounts/[account number]'

Dim Body As String
      Body = "<envelopeDefinition xmlns=\" & Chr(34) & "http://www.docusign.com/restapi\" & Chr(34) & ">" + _
            "<accountId>MyAccountID</accountId>" + _
            "<status>sent</status>" + _
            "<emailSubject>DocuSign API Call - Signature request from template</emailSubject>" + _
            "<templateId>MyTemplateID</templateId>" + _
            "<templateRoles>" + _
            "<templateRole>" + _
            "<name>Ronco</name>" + _
            "<email>rolsen@myemail.com</email>" + _
            "<roleName>Rono</roleName>" + _
            "</templateRole>" + _
            "</templateRoles>" + _
            "</envelopeDefinition>"


Debug.Print Body

httpRequest.Open "POST", sigURL, False

httpRequest.setRequestHeader Body, "application/xml"
httpRequest.setRequestHeader "X-DocuSign-Authentication", Author
'httpRequest.setRequestHeader "Accept", "application/xml"
httpRequest.setRequestHeader "Content-Type", "multipart/form-data"
'httpRequest.setRequestHeader "Content-Type", "application/xml"
httpRequest.send

Debug.Print httpRequest.Status, "A"
Debug.Print httpRequest.statusText, "B"
Debug.Print httpRequest.responseText, "C"

Exit Sub

响应消息如下。我理解错误来自没有正确设置的.setRequestHeader。在哪里可以找到需要为每个.setRequestHeader设置DocuSign将接受的头和值?

400坏请求{ "errorCode":"ENVELOPE_IS_INCOMPLETE",“消息”:“信封不完整。完整的信封需要文档、收件人、标签和主题行。Content不包含边界参数”}。

EN

回答 1

Stack Overflow用户

发布于 2015-10-21 22:04:18

当从模板发送签名请求时,需要将API调用的Content-Type设置为application/jsonapplication/xml。现在看来,您已经将其注释掉,并发送了一个multipart/form-data请求。注释这一行,并将其添加回:

代码语言:javascript
复制
httpRequest.setRequestHeader "Content-Type", "application/xml"

如果这不起作用,或者您已经尝试过,我建议通过您的开发人员帐户首选项启用请求日志记录,并检查正在设置的原始请求,以确保您的代码正在生成所期望的内容。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33135965

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档