This topic contains 16 replies, has 3 voices, and was last updated by  Duo_Liang 3 months, 1 week ago.

  • Author
    Posts
  • Participant
    sudhangi
    Regular Member
    Member since: 01.12.2015
    Number of posts: 59

    Hi,
    When I try to updatePackage() I get the following exception. I am trying to update the package with additional signer information to a placeholder block in the document when I get this problem. Any idea why would this happen?
    com.silanis.esl.sdk.internal.EslServerException: Could not update role Exception: HTTP PUT on URI https://sandbox.e-signlive.com/api/packages/fb433c2d-8fa3-47db-97d9-81e92ff5780d/roles/FormB_RequestingProgramOfficial resulted in response with status code: [500, Internal Server Error]. Optional details: {“messageKey”:”error.internal.default”,”packageId”:null,”entity”:null,”technical”:null,”message”:”Unexpected error. We apologize for any inconvenience this may have caused you, please try again. If the problem persists, please contact our support team.”,”code”:500,”name”:”Unhandled Server Error”}
    com.silanis.esl.sdk.internal.EslServerException: Could not update role Exception: HTTP PUT on URI https://sandbox.e-signlive.com/api/packages/fb433c2d-8fa3-47db-97d9-81e92ff5780d/roles/FormB_RequestingProgramOfficial resulted in response with status code: [500, Internal Server Error]. Optional details: {“messageKey”:”error.internal.default”,”packageId”:null,”entity”:null,”technical”:null,”message”:”Unexpected error. We apologize for any inconvenience this may have caused you, please try again. If the problem persists, please contact our support team.”,”code”:500,”name”:”Unhandled Server Error”}
    at com.silanis.esl.sdk.service.PackageService.updateRole(PackageService.java:501)
    at com.silanis.esl.sdk.service.PackageService.updatePackage(PackageService.java:170)
    at com.silanis.esl.sdk.EslClient.updatePackage(EslClient.java:253)

    Thanks,
    Sudhangi

    Keymaster
    mwilliams
    Guru
    Member since: 21.08.2015
    Number of posts: 904

    Score

    0

    Is this a package or a template that you’re trying to edit? The reason I ask is you say you’re trying to update the placeholder, which would be an empty signer in a template used to reserve the signer slot for the actual signer so you can place signatures and fields on documents that will be inherited by the eventual signer. If you’re meaning you’re trying to update a signer in a package, is the package in DRAFT mode when you’re trying to do the update? Has the signer signed anything already at the time of update?

    Please let me know!


    – Michael
    Partner and Developer Technologies Manager, OneSpan
    Facebook – https://www.facebook.com/michael.williams1120
    Twitter – https://twitter.com/mwilliams1120
    LinkedIn – https://www.linkedin.com/in/mwilliams1120
    Participant
    sudhangi
    Regular Member
    Member since: 01.12.2015
    Number of posts: 59

    Score

    0

    Hi Micheal,
    Thank you for your response. This is actually a case where I have to do the following:
    1. Build a package say ‘PackageOne’
    2. Add 2 documents to this PackageOne
    3. Add multiple signers to each of these documents
    4. Apply 2 different layouts to the 2 documents. Which will have different placeholder names for the signing blocks.
    5. Based on a business logic I need to assign signers to each placeholder
    6. Among the signers, one signer will need to sign 2 documents.
    7. During the above 6 steps, PacakageOne will be in draft mode.

    I hope this helps clarify what I am trying to do.

    Thanks,
    Sudhangi

    Keymaster
    mwilliams
    Guru
    Member since: 21.08.2015
    Number of posts: 904

    Score

    0

    Hey Sudhangi,

    Thanks for the info. What I’m still not certain on is if you’re building a package from scratch or using a template.


    – Michael
    Partner and Developer Technologies Manager, OneSpan
    Facebook – https://www.facebook.com/michael.williams1120
    Twitter – https://twitter.com/mwilliams1120
    LinkedIn – https://www.linkedin.com/in/mwilliams1120
    Participant
    sudhangi
    Regular Member
    Member since: 01.12.2015
    Number of posts: 59

    Score

    0

    Hey Michael,
    I am building a package from scratch.
    Thanks,
    Sudhangi

    Keymaster
    mwilliams
    Guru
    Member since: 21.08.2015
    Number of posts: 904

    Score

    0

    Okay. Thank you. Are you against building all of this at one time? Or do you need to add all of these things separately?

    A good guide to look at for doing all of this at one time is this one:

    Quick Start Guide – Create and Send a Package with Java SDK

    If you’re wanting to do this in multiple steps like you listed above, you can do that, too. You can build a document package like in the guide above only leaving out the document and signer portions.

    Then, add documents as in this guide:

    Document Management Guide

    Then, you add signers to the package:

    Signer Management Guide

    Then, add signatures to the documents:

    Signatures Guide

    These signatures can also be added more dynamically at document upload time with Document Extraction or Text Anchors.

    The easiest way to do this would be the Quick Start Guide where you just define it all at one time.

    So, to recap, to create a package from scratch, you don’t use Placeholders. You create a document package, add your signers (anyone that will sign anywhere in any of your documents), you add the documents, and finally, define the signatures and fields that the signers you’ve already defined need to fill out. Hopefully this makes things more clear on how you should set up your document packages. Let me know.


    – Michael
    Partner and Developer Technologies Manager, OneSpan
    Facebook – https://www.facebook.com/michael.williams1120
    Twitter – https://twitter.com/mwilliams1120
    LinkedIn – https://www.linkedin.com/in/mwilliams1120
    Participant
    sudhangi
    Regular Member
    Member since: 01.12.2015
    Number of posts: 59

    Score

    0

    Hi Michael,
    Thank you for your response. Let me try and simplify this for you. Below is a simple program very similar to what I am trying to do:

    int itr = 0;
    PackageId docLayoutId =null;
    Placeholder p1 =null;
    Placeholder p0 =null;
    List<DocumentPackage> layouts = eslClient.getLayoutService().getLayouts(Direction.DESCENDING, new PageRequest(itr, 50));
    for (DocumentPackage myLayout : layouts) {
    if (myLayout.getName().equals(“SampleShare3”) )
    {
    docLayoutId = myLayout.getId();
    p0 = new Placeholder( “Signer1”);
    p1 = new Placeholder( “Signer2”);
    break;

    }
    }
    PackageBuilder package1 = PackageBuilder.newPackageNamed(“Layout”);
    package1.withSenderInfo(SenderInfoBuilder.newSenderInfo(“email1@mail.com”));
    signer = SignerBuilder.newSignerWithEmail(“email1@mail.com”)
    .withFirstName(“Sudhangi”)
    .withLastName(“ICFI”).replacing(p1);
    package1.withSigner(signer);

    signer=SignerBuilder.newSignerWithEmail(“email2@mail.com”)
    .withFirstName(“Dss”)
    .withLastName(“Dev”).replacing(p0);
    package1.withSigner(signer);

    Document mydoc = DocumentBuilder.newDocumentWithName(“TEST-AAAP-Short”)
    .fromFile(“/Users/SAmbekar/Desktop/Development/GSA/AAAP/TEST-AAAP-Short.PDF”)
    .build();
    package1.withDocument(mydoc);

    DocumentPackage completePackage = package1
    .withAttributes(DocumentPackageAttributesBuilder.newDocumentPackageAttributes()
    .withAttribute(“orgName”, “IACP”)
    .build())
    .build();
    PackageId packageId = eslClient.createPackage(completePackage);
    List<com.silanis.esl.sdk.Document> packageDocuments= eslClient.getPackage(packageId).getDocuments();

    for (int k = 1; k < packageDocuments.size(); k++) {
    String docId = packageDocuments.get(k).getId().toString();
    eslClient.getLayoutService().applyLayout(packageId, docId, docLayoutId.toString());
    }
    /*There are a total of 4 placeholders, Signer1, Signer2, Signer3 and Signer4. */
    for(Signer s: eslClient.getPackage(packageId).getPlaceholders())
    {

    System.out.println(“PlaceHolderName+\t”+s.getPlaceholderName());
    if (s.getPlaceholderName() == “Signer3”) {
    /*Add the signer email1@mail.com to this placeholder ‘Signer3’*/
    /*How do I update the package at this point?*/
    }
    else {
    /*Remove the placeholder Signer4 */
    eslClient.getPackageService().removeSigner(packageId, s.getId());
    }

    }
    System.out.println(“PackageID+\t”+packageId.toString());

    }

    }

    If you look in the code, I am trying to use a previous signer as assign that to another placeholder Signer3, how do I update the package at this point?
    Thanks,
    Sudhangi

    Attachments:
    You must be logged in to view attached files.
    Keymaster
    mwilliams
    Guru
    Member since: 21.08.2015
    Number of posts: 904

    Score

    0

    Okay. I’m with you, now.

    You won’t be able to assign the same email address to signer3 as is for signer1. What you’ll probably have to do to handle your issue is to pass a dummy signer for signer3, then, walk through the document package and reassign all signatures and fields for signer3 and give them to signer1. Finally, remove signer 3 and placeholder 4. I have not tested this, yet, but I will right now and let you know the result.


    – Michael
    Partner and Developer Technologies Manager, OneSpan
    Facebook – https://www.facebook.com/michael.williams1120
    Twitter – https://twitter.com/mwilliams1120
    LinkedIn – https://www.linkedin.com/in/mwilliams1120
    Keymaster
    mwilliams
    Guru
    Member since: 21.08.2015
    Number of posts: 904
    Approved answer

    Score

    0

    Take a look at this code:

    DocumentId docId = createdPackage.getDocument("sampleAgreement").getId(); //grab document
            eslClient.getLayoutService().applyLayout(myPackage, docId.getId(), docLayoutId.getId()); //apply layout (3 placeholders) My document contains signatures for 3 different signers. The third being a dummy email so I can repurpose that signature from the layout to be for signer1.
            
            createdPackage = eslClient.getPackage(myPackage); //get updated package after applying layout
            Collection mysigs = createdPackage.getDocument("sampleAgreement").getSignatures(); //get all signatures
            List sigsToMove = new ArrayList(); //create a new List to store all signatures in for "update".
            Signature mynewsig = null; //create signature object to use to create new signatures to transfer from signer3 to signer1.
            for(Signature sig : mysigs){ //walk through signatures
            	String email = sig.getSignerEmail();
            	if (email.equals("temporaryemail@example.com")){ //check signature email against known dummy email
            		Collection myfields = sig.getFields(); //grab fields from signature
            		mynewsig = SignatureBuilder.signatureFor("signer1.email@example.com") //create new signature for signer1 and transfer all value from
            				.atPosition(sig.getX(), sig.getY())
            				.withSize(sig.getWidth(), sig.getHeight())
            				.withId(sig.getId())
            				.onPage(sig.getPage())
            				.build();
            		mynewsig.addFields(myfields); //add all fields from old signature to new signature
            		sigsToMove.add(mynewsig); //add new signature to signature list
            	}
            	else{
            		sigsToMove.add(sig);//add unchanged signature to signature list
            	}
            }
           	eslClient.getPackageService().removeSigner(myPackage, createdPackage.getSigner("temporaryemail@example.com").getId()); //remove the temp signer
            createdPackage = eslClient.getPackage(myPackage); //get updated package
            eslClient.getApprovalService().updateSignatures(createdPackage, docId.getId(), sigsToMove); //update all signatures for document

    You would just have to do this for each document that you apply a layout to.

    Hope this helps. Let me know if you have issues.


    – Michael
    Partner and Developer Technologies Manager, OneSpan
    Facebook – https://www.facebook.com/michael.williams1120
    Twitter – https://twitter.com/mwilliams1120
    LinkedIn – https://www.linkedin.com/in/mwilliams1120
    Participant
    sudhangi
    Regular Member
    Member since: 01.12.2015
    Number of posts: 59

    Score

    0

    Hi Michael,
    Appreciate your detailed response. Let me try this out. I will get back to you.
    Thanks,
    Sudhangi

    Keymaster
    mwilliams
    Guru
    Member since: 21.08.2015
    Number of posts: 904

    Score

    0

    Not a problem at all. Definitely let me know if you have any issues with it.


    – Michael
    Partner and Developer Technologies Manager, OneSpan
    Facebook – https://www.facebook.com/michael.williams1120
    Twitter – https://twitter.com/mwilliams1120
    LinkedIn – https://www.linkedin.com/in/mwilliams1120
    Participant
    sudhangi
    Regular Member
    Member since: 01.12.2015
    Number of posts: 59

    Score

    0

    Hi Michael,
    Your solution of using dummy email worked.
    I am going to try this on the actual requirement, which involves multiple documents, multiple layouts and multiple placeholders. I will keep you posted once I get that working.
    Thank you very much,
    Sudhangi

    Keymaster
    mwilliams
    Guru
    Member since: 21.08.2015
    Number of posts: 904

    Score

    0

    Great to hear! Let me know how it goes. If it’s very difficult to get everything working properly, you could always just avoid the templates and create the package completely from scratch each time depending on the number of signers, since you’re integrated. Layouts and templates are generally utilized most by UI users to avoid having to manually upload documents/place fields. 🙂


    – Michael
    Partner and Developer Technologies Manager, OneSpan
    Facebook – https://www.facebook.com/michael.williams1120
    Twitter – https://twitter.com/mwilliams1120
    LinkedIn – https://www.linkedin.com/in/mwilliams1120
    Participant
    sudhangi
    Regular Member
    Member since: 01.12.2015
    Number of posts: 59

    Score

    0

    Thank you very much Michael.
    That solution worked for me.
    Regards,
    Sudhangi

    Keymaster
    mwilliams
    Guru
    Member since: 21.08.2015
    Number of posts: 904

    Score

    0

    Great! Thanks for the update! 🙂


    – Michael
    Partner and Developer Technologies Manager, OneSpan
    Facebook – https://www.facebook.com/michael.williams1120
    Twitter – https://twitter.com/mwilliams1120
    LinkedIn – https://www.linkedin.com/in/mwilliams1120

You must be logged in to reply to this topic.