EnvelopesApi.getDocument - 错误:java.lang.Class无法强制转换为java.lang.reflect.ParameterizedType

时间:2017-03-06 22:41:51

标签: android docusignapi

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

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

我知道accountId,envelopeId是有效的,而不是null和正确的。我也使用与用于签署文档相同的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)'

1 个答案:

答案 0 :(得分:1)

试试这个

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

查看完整的api食谱here