This topic contains 2 replies, has 2 voices, and was last updated by  Sudipta 9 months, 2 weeks ago.

  • Author
    Posts
  • Participant
    Sudipta
    Member
    Member since: 10.01.2018
    Number of posts: 26

    Hello

    I am not able to fetch the documents after signing a package. Following is the code I use to fetch and extract the documents for a signed package:

    import java.util.zip.ZipEntry;
    import java.util.zip.ZipInputStream;
    import static org.springframework.util.StreamUtils.BUFFER_SIZE;
    .
    .
    .
    EslClient eslClient = new EslClient(apiKey, apiUrl);
    byte[] documentZip = eslClient.downloadZippedDocuments(packageId)
    inal List<String> signedDocumentArray = new ArrayList<>();
    try(ZipInputStream zipInputStream = new ZipInputStream(new ByteArrayInputStream(documentZip))){
    ZipEntry entry;
    while((entry = zipInputStream.getNextEntry())!= null && !entry.isDirectory() && !entry.getName().contains(CONSENT_FORM_NAME)){
    byte[] fileBytes = new byte[BUFFER_SIZE];
    if (zipInputStream.read(fileBytes) > 0) {
    signedDocumentArray.add(Base64.getEncoder().withoutPadding().encodeToString(fileBytes));
    }else {
    throw new BusinessException(ErrorCode.VENDOR_DOCUMENT_COULD_NOT_BE_PARSED.value());
    }
    zipInputStream.closeEntry();
    }
    }

    if(signedDocumentArray.isEmpty()) {
    // throw error
    }

    Before fetching the document, we check the status of the package using the following SDK method:

    eslClient.getSigningStatus(packageId, null, null);

    The status that we get is ‘COMPLETE’ which I am assuming means document is signed.

    Can somebody help me resolve this issue?

    -Sudipta

    Keymaster
    Haris
    Jedi Master
    Member since: 05.11.2015
    Number of posts: 1450

    Score

    0

    Hey Sudipta,

    Have a look at our quick start guide on how to download signed documents: https://developer.esignlive.com/guides/quick-start/check-package-status-and-download-documents-java/. Let me know if this works for you.


    Haris Haidary
    OneSpan Technical Consultant
    Participant
    Sudipta
    Member
    Member since: 10.01.2018
    Number of posts: 26

    Score

    0

    Thanks Haris the quick turnaround. I am able to download the signed documents on disk with the code sample that you shared. But I needed to extract the files inside the zip in memory as we have a subsequent workflow which needs the documents in memory. But I believe, w.r.t. eSignLive, the document zip with the signed files is being returned successfully. So, the problem is not at your end for sure. Thanks for all the help.

    I need to find out the issue in the code we are using to extract the files. Thanks again.

    Regards
    Sudipta

You must be logged in to reply to this topic.