Adobe Echo Sign发送PDF文件

时间:2013-07-02 11:50:15

标签: echosign

我正在使用Adobe Echo标志,我从他们的网站下载了示例代码,我使用此示例代码发送文档,它在sendDocument方法中缺少一些代码,所以我已经更改了它。它给出了SoapHeader Exception,在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);

有人可以推荐一些Adobe Echo Sign的示例代码吗?

1 个答案:

答案 0 :(得分:0)

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

我无法看到您的代码出现任何问题但是EchoSign API指南说不推荐使用'tos'字段,而应该使用收件人字段。这意味着你不能使用paramaterised构造函数。尝试创建文档创建信息(这是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
};

请注意,使用recipientInfo数组时,似乎必须将roleSpecified字段 设置为true。这个小小的场地绊倒了我多年,我收到了与你类似的错误。