DocuSign:调用CreateEnvelope出错

本文关键字:出错 CreateEnvelope 调用 DocuSign | 更新日期: 2023-09-27 18:16:55

我有以下代码用于添加一个带有本地文件的新信封:

EnvelopeDefinition envelope = new EnvelopeDefinition
{
    Status = "sent"
};
// Get the contract file
Byte[] bytes = File.ReadAllBytes("[Local Filename]");
// Add a document to the envelope
DocuSign.eSign.Model.Document doc = new DocuSign.eSign.Model.Document();
doc.DocumentBase64 = System.Convert.ToBase64String(bytes);
doc.Name = contract.FileName;
doc.DocumentId = "1";
envelope.Documents = new List<DocuSign.eSign.Model.Document>();
envelope.Documents.Add(doc);
// Add a recipient to sign the documeent
Signer signer = new Signer();
signer.Email = recipientEmail;
signer.Name = recipientName;
signer.RecipientId = "1";
// Create a |SignHere| tab somewhere on the document for the recipient to sign
signer.Tabs = new Tabs();
signer.Tabs.SignHereTabs = new List<SignHere>();
SignHere signHere = new SignHere();
signHere.DocumentId = "1";
signHere.PageNumber = "1";
signHere.RecipientId = "1";
signHere.XPosition = "100";
signHere.YPosition = "150";
signer.Tabs.SignHereTabs.Add(signHere);
envelope.Recipients = new Recipients();
envelope.Recipients.Signers = new List<Signer>();
envelope.Recipients.Signers.Add(signer);
DocuSignAuthentication Creds = new DocuSignAuthentication
{
    Username = "[My Username]",
    Password = "[My Password]",
    IntegratorKey = "[My Integration Key]"
};
ApiClient apiClient = new ApiClient("https://demo.docusign.net/restapi/v2/accounts/XXXXXXX");
string authHeader = JsonConvert.SerializeObject(Creds);
DocuSign.eSign.Client.Configuration cfg = new DocuSign.eSign.Client.Configuration(apiClient);
cfg.AddDefaultHeader("X-DocuSign-Authentication", authHeader);
EnvelopesApi envelopeApi = new EnvelopesApi(cfg);
EnvelopeSummary response = envelopeApi.CreateEnvelope("XXXXXXX", envelope);

服务器返回的错误信息非常少:

[ApiException: Error calling CreateEnvelope: ]
DocuSign.eSign.Api.EnvelopesApi.CreateEnvelopeWithHttpInfo(String accountId, EnvelopeDefinition envelopeDefinition, CreateEnvelopeOptions options) in
Y:'dev'SDKs'csharp'sdk'src'main'csharp'DocuSign'eSign'Api'EnvelopesApi.cs:2606
DocuSign.eSign.Api.EnvelopesApi.CreateEnvelope(String accountId, EnvelopeDefinition envelopeDefinition, CreateEnvelopeOptions options) in Y:'dev'SDKs'csharp'sdk'src'main'csharp'DocuSign'eSign'Api'EnvelopesApi.cs:2532
[Rest of the stack trace relates to our code]

如果我们尝试使用fiddler从服务器捕获任何错误消息,则错误变为:

无法为SSL/TLS安全通道建立信任关系

有什么方法可以得到更多关于我们的请求的信息吗?或者是否有一个未加密的开发人员端点可用来解决这类问题?如能提供任何帮助,我将不胜感激。

DocuSign:调用CreateEnvelope出错

错误"无法为SSL/TLS安全通道建立信任关系"意味着从客户端(可以是您的服务器,但在某种意义上是客户端,它使HTTPRequest)到服务器(DocuSign在这种情况下)的HTTPRequest调用不能使用TLS over SSL (https://address)来确保有一个证书允许加密HTTPRequest和HttpResponse中的信息。发生这种情况的原因有很多,包括客户机上没有TLS的当前版本,以及证书错误或网络存在其他问题。我建议尝试从不同的服务器(可能在公司网络之外)进行此调用,以隔离问题。另外,检查TLS的版本以确保它至少为1.1