Chaitra | Posts: 1

Multiple signers and Multiple documents - com.silanis.esl.sdk.internal.EslServerException: Could not create a new package

0 votes

Exception in thread "main" com.silanis.esl.sdk.internal.EslServerException: Could not create a new package in one-step Exception: HTTP POST on URI https://sandbox.esignlive.com/api/packages resulted in response with status code: [400, Bad Request]. Optional details: {"messageKey":"error.validation.sendPackage.noApprovals","message":"Cannot send package without approvals.","code":400,"name":"Validation Error"}
    at com.silanis.esl.sdk.service.PackageService.createPackageOneStep(PackageService.java:117)
    at com.silanis.esl.sdk.EslClient.createPackageOneStep(EslClient.java:333)
    at esign.DynamicTextTagExtractionTwoSigners.main(DynamicTextTagExtractionTwoSigners.java:56)
Caused by: com.silanis.esl.sdk.internal.RequestException: HTTP POST on URI https://sandbox.esignlive.com/api/packages resulted in response with status code: [400, Bad Request]. Optional details: {"messageKey":"error.validation.sendPackage.noApprovals","message":"Cannot send package without approvals.","code":400,"name":"Validation Error"}
    at com.silanis.esl.sdk.internal.RestClient.execute(RestClient.java:214)
    at com.silanis.esl.sdk.internal.RestClient.postMultipartPackage(RestClient.java:163)
    at com.silanis.esl.sdk.service.PackageService.createPackageOneStep(PackageService.java:113)
    ... 2 more
 

        EslClient eslClient = new EslClient(API_KEY, API_URL); 
        Calendar calendar = Calendar.getInstance(); 
        calendar.add(Calendar.DATE, 30); 
        List<Signer> signerList = new ArrayList<>(); 
        Signer signer1 = SignerBuilder.newSignerWithEmail("[email protected]") 
                .withFirstName("xx") 
                .withLastName("xx") 
                .withCustomId("Signer1")
                .build(); 
        
        Signer signer2 = SignerBuilder.newSignerWithEmail("[email protected]") 
                .withFirstName("xx") 
                .withLastName("xx") 
                .withCustomId("Signer2")
                .build(); 
        
        signerList.add(signer1); 
        signerList.add(signer2); 
        PackageBuilder packageToBuild = PackageBuilder.newPackageNamed("Multiple Documents Example") 
                .withStatus(PackageStatus.SENT); 
        
        for(Signer signer : signerList){ 
            packageToBuild.withSigner(signer); 
        } 
        
        List<Document> documentList = new ArrayList<>(); 
        Document document1 = DocumentBuilder.newDocumentWithName("Disclaimers") 
                .withId("document2") 
                .fromFile("C:/xxx/Disclaimers.pdf") 
                .withExtractionType(ExtractionType.TEXT_TAGS) 
                .enableExtraction()
                .build(); 
        
        Document document2 = DocumentBuilder.newDocumentWithName("Agreement") 
                .withId("document1") 
                .fromFile("C:/xxx/sdl-agreement_two_signers.pdf") 
                .withExtractionType(ExtractionType.TEXT_TAGS) 
                .enableExtraction()
                .build(); 
        
        for(Document document : documentList){ 
            packageToBuild.withDocument(document); 
        } 
        
        DocumentPackage pkg = packageToBuild.expiresAt(calendar.getTime()) 
                .build(); 
        
        PackageId packageId = eslClient.createPackageOneStep(pkg); 
        System.out.println(packageId); 
        System.out.println(eslClient.getPackageService().getSigningUrl(packageId, "Signer1")); 
        System.out.println(eslClient.getPackageService().getSigningUrl(packageId, "Signer2")); 


Duo_Liang | Posts: 3776

Reply to: Multiple signers and Multiple documents - com.silanis.esl.sdk.internal.EslServerException: Could not create a new package

0 votes

Hi Chaitra,

 

Thanks for your post!

From the error message "Cannot send package without approvals", it suggests that there's no signature(approval) get detected.

As per the code, you are using text tags to automatically extract signatures and fields. Could you double check whether the text tags used in the PDF are following the syntax like:

{{esl:Signer1:Signature}}

{{esl:Signer2:Signature}}

If there's no obvious problem in the tags, could you share the PDF (if there's no sensitive information) so that I can look further into the issue?

 

Duo


Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off