0

我正在研究 Adob​​e Echo 标志,我已经从他们的网站下载了示例代码,我正在使用这个示例代码来发送文档,它在 sendDocument 方法中缺少一些代码,所以我已经更改了它。它给出了 SoapHeader 异常,在 InnerException 中没有任何内容,

{"apiActionId=XHZI4WF4BV693YS"}

以下是我发送文件的代码

 public static void sendDocument(string apiKey, string fileName, string recipient)
        {
            ES = new EchoSignDocumentService16();
            FileStream file = File.OpenRead(fileName);
            secure.echosign.com.FileInfo[] fileInfos = new secure.echosign.com.FileInfo[1];
            fileInfos[0] = new secure.echosign.com.FileInfo(fileName, null, file);
            SenderInfo senderInfo = null;
            string[] recipients = new string[1];
            recipients[0] = recipient;
            DocumentCreationInfo documentInfo = new DocumentCreationInfo(
                recipients,
                "Test from SOAP: " + fileName,
                "This is neat.",
                fileInfos,
                SignatureType.ESIGN,
                SignatureFlow.SENDER_SIGNATURE_NOT_REQUIRED
            );

            DocumentKey[] documentKeys;
            senderInfo = new SenderInfo(recipient, "password", "APIKEY");
            documentKeys = ES.sendDocument(apiKey, senderInfo, documentInfo);
            Console.WriteLine("Document key is: " + documentKeys[0].documentKey);
        }

它在这条线上给出了例外

 documentKeys = ES.sendDocument(apiKey, senderInfo, documentInfo);

谁能推荐一些 Adob​​e Echo Sign 的示例代码?

4

1 回答 1

0

在您登录的帐户页面上,您可以查看 API 日志。如果您检查您的请求的日志条目,您可能会在那里找到更多信息。

我看不出你的代码有什么问题,但是 EchoSign API 指南说“tos”字段已被弃用,应该使用收件人字段。有用的是,这意味着您不能使用参数化构造函数。尝试这样创建您的文档创建信息(这是 C#,但如果您需要 Java,应该很容易弄清楚):

RecipientInfo[] recipientInfo = new RecipientInfo[1];
recipientInfo[0] = new RecipientInfo
{
    email = "recipient",
    role = RecipientRole.SIGNER,
    roleSpecified = true 
};

DocumentCreationInfo documentCreationInfo = new DocumentCreationInfo
{
    recipients = recipientInfo,
    name = "Test from SOAP: " + fileName,
    message = "This is neat.",
    fileInfos = fileInfos,
    signatureType = SignatureType.ESIGN,
    signatureFlow = SignatureFlow.SENDER_SIGNATURE_NOT_REQUIRED
};

请注意,在使用接收者信息数组时,似乎必须将 roleSpecified 字段设置为 true。这个小领域让我绊倒了很长时间,我收到了与你类似的错误。

于 2013-07-22T00:51:37.943 回答