【问题标题】:EnvelopesApi.getDocument - error: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedTypeEnvelopesApi.getDocument - 错误:java.lang.Class 无法转换为 java.lang.reflect.ParameterizedType
【发布时间】:2020-08-26 15:22:56
【问题描述】:

我正在使用演示帐户和 Android 应用程序中的 Java SDK 测试 Docusign 嵌入签名。到目前为止,我能够签署一份 PDF 文档并通过深度链接将 returnUrl 发送回我的应用程序。都好。但是在收到应用程序中的签名确认后,我需要获得完成证书。但是当我调用 EnvelopesApi.getDocument(accountId, envelopeId, "combined") 我得到以下错误:

java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType

我知道 accountId、envelopeId 是有效的,不为空且正确。我还使用了用于签署文档的同一个 ApiClient,因此它也有效且有效。有谁知道这个电话可能有什么问题?

这是电话

EnvelopesApi api = new EnvelopesApi(apiClient);
try {

     // The error is in the line below:

     byte[] pdfBytes = api.getDocument(accountId, envelopeId, "combined");

} catch (ApiException e) {
     e.printStackTrace();
}

这是完整的错误日志:

E/AndroidRuntime: FATALEXCEPTION: AsyncTask #3
            java.lang.RuntimeException: An error occurred while executing doInBackground()
               at android.os.AsyncTask$3.done(AsyncTask.java:309)
               at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
               at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
               at java.util.concurrent.FutureTask.run(FutureTask.java:242)
               at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
               at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
               at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
               at java.lang.Thread.run(Thread.java:818)
            Caused by: java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType
               at com.sun.jersey.api.client.GenericType.getClass(GenericType.java:103)
               at com.sun.jersey.api.client.GenericType.<init>(GenericType.java:72)
               at com.docusign.esign.api.EnvelopesApi$24.<init>(EnvelopesApi.java:1928)
               at com.docusign.esign.api.EnvelopesApi.getDocument(EnvelopesApi.java:1928)
               at com.docusign.esign.api.EnvelopesApi.getDocument(EnvelopesApi.java:1849)
               at br.com.cbyk.privatelabel.NovaPropostaActivity$2.doInBackground(NovaPropostaActivity.java:454)
               at br.com.cbyk.privatelabel.NovaPropostaActivity$2.doInBackground(NovaPropostaActivity.java:448)
               at android.os.AsyncTask$2.call(AsyncTask.java:295)
               at java.util.concurrent.FutureTask.run(FutureTask.java:237)
               at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) 
               at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
               at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
               at java.lang.Thread.run(Thread.java:818)'

【问题讨论】:

    标签: android docusignapi


    【解决方案1】:

    试试这个

    File document = envelopesApi.getDocument(accountId, envelopeId, documentId);
    

    查看完整的 api 配方 here

    【讨论】:

    • 也许 api 配方在这个调用中是错误的,因为“envelopesApi.getDocuments”不返回文件类型。它返回字节 []。还是我错过了什么?
    • 对此有何新想法,@CodingDawg?
    猜你喜欢
    • 1970-01-01
    • 2015-04-19
    • 2012-02-13
    • 1970-01-01
    • 2014-05-29
    • 2012-05-22
    • 1970-01-01
    • 1970-01-01
    • 2016-11-22
    相关资源
    最近更新 更多