Unable to Apply Layout with Placeholders that Specify Both ID and Description
Tuesday, July 25, 2017 at 05:08amHello,
I am running into an issue when using a layout that was created with placeholders that specify both an ID and a description. The layout can be successfully created and viewed, but the layout cannot be applied to a package. This only seems to occur when creating placeholders with both an ID and description specified as using the same layout but only specifying IDs for placeholders will allow the layout to be applied to the package. Is this a eSignLive issue or am I doing something wrong?
Here's the exception that I get when trying to apply a layout created with placeholder which specifies both an ID and Description:
Exception in thread "main" com.silanis.esl.sdk.internal.EslServerException: Could not apply layout. Exception: HTTP POST on URI https://sandbox.esignlive.com/api/packages/-wqoXrzanpHBLLqwRlIla6rZaEw=/documents/packageDocumentId/layout?layoutId=TWyrFYtJmZpcOc7IV6mEswpkwp8= resulted in response with status code: [500, Internal Server Error]. Optional details: {"messageKey":"error.internal.default","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.LayoutService.applyLayout(LayoutService.java:110) at esignature.layout.LayoutErrorExample.execute(LayoutErrorExample.java:84) at esignature.layout.LayoutErrorExample.main(LayoutErrorExample.java:26) Caused by: com.silanis.esl.sdk.internal.RequestException: HTTP POST on URI https://sandbox.esignlive.com/api/packages/-wqoXrzanpHBLLqwRlIla6rZaEw=/documents/packageDocumentId/layout?layoutId=TWyrFYtJmZpcOc7IV6mEswpkwp8= resulted in response with status code: [500, Internal Server Error]. Optional details: {"messageKey":"error.internal.default","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.internal.RestClient.execute(RestClient.java:192) at com.silanis.esl.sdk.internal.RestClient.post(RestClient.java:105) at com.silanis.esl.sdk.service.LayoutService.applyLayout(LayoutService.java:108) ... 2 moreHere's the sample code that I've been using to test this issue. You should be able to run this by just specifying the input streams for the document and layout as well as create the EslClient. Notice that of the three different ways that Placeholder constructor is used only the first causes the exception. I've also attempted to use both the "customId" and "replacing" on the signer when building the package that the layout is applied to, but neither is successfully working when using both ID and description is specified for the placeholder.
// Create the placeholder with both an ID and description - Causes Exception Placeholder placeholder = new Placeholder("customId", "description"); // Create the Placeholder by only an ID //Placeholder placeholder = new Placeholder("customId"); // Create the Placeholder using duplicate values for ID and description //Placeholder placeholder = new Placeholder("customId", "customId"); // Create Layout to apply to the package DocumentPackage eslLayoutPackage = PackageBuilder.newPackageNamed("layoutPackage") .withDocument( DocumentBuilder.newDocumentWithName("layoutDocumentName") .withId("layoutDocumentId") .fromStream(layoutStream, DocumentType.WORD) .withSignature(SignatureBuilder.signatureFor(placeholder).onPage(0).atPosition(150, 150)) .build() ) .withSigner( SignerBuilder.newSignerPlaceholder(placeholder).build() ) .build(); PackageId layoutPackageId = eslClient.createPackage(eslLayoutPackage); eslLayoutPackage.setId(layoutPackageId); String eslLayoutId = eslClient.getLayoutService().createLayout(eslLayoutPackage); eslLayoutPackage.setId(new PackageId(eslLayoutId)); // Create Package DocumentPackage eslPackage = PackageBuilder.newPackageNamed("packageName") .withSigner( SignerBuilder.newSignerWithEmail("[email protected]") .withFirstName("First") .withLastName("Last") //.withCustomId(placeholder.getId()) .replacing(placeholder) ) .withDocument(DocumentBuilder.newDocumentWithName("packageDocumentName") .withId("packageDocumentId") .fromStream(documentStream, DocumentType.WORD) ) .build(); PackageId eslPackageId = eslClient.createPackage(eslPackage); eslPackage.setId(eslPackageId); eslClient.getLayoutService().applyLayout(eslPackage.getId(), "packageDocumentId", eslLayoutId);
Reply to: Unable to Apply Layout with Placeholders that Specify Both ID and Description
Tuesday, July 25, 2017 at 09:02amPlaceholder placeholder = new Placeholder("customId", "description");
is throwing an exception, I'm inclined to say that it might have something to do with the length of the String (sincePlaceholder placeholder = new Placeholder("customId", "customId");
isn't throwing one). Can you try reducing the description to 64 characters as that is the maximum you can go through the web UI?Reply to: Unable to Apply Layout with Placeholders that Specify Both ID and Description
Tuesday, July 25, 2017 at 09:55amPlaceholder("customId", "customId");
example, that was just included to show that using the placeholder constructor with both parameters will only seem to work when both of the parameters are identical. Is this an eSignLive issue?Reply to: Unable to Apply Layout with Placeholders that Specify Both ID and Description
Tuesday, July 25, 2017 at 01:56pmReply to: Unable to Apply Layout with Placeholders that Specify Both ID and Description
Wednesday, July 26, 2017 at 06:04amReply to: Unable to Apply Layout with Placeholders that Specify Both ID and Description
Wednesday, July 26, 2017 at 08:26amReply to: Unable to Apply Layout with Placeholders that Specify Both ID and Description
Thursday, July 27, 2017 at 05:02am.replacing()
call to replace a placeholder, but there isn't a placeholder to be replaced (you're essentially creating a new package with a signer and a document). The.replacing()
call is used when you have a template with a placeholder and you're looking to create a new package from it while replacing the placeholder with a new signer information: https://developer.esignlive.com/guides/feature-guides/create-package-from-template/Reply to: Unable to Apply Layout with Placeholders that Specify Both ID and Description
Thursday, July 27, 2017 at 05:33amLayoutService.applyLayout
method for that package, you can confirm that by seeing that the signature created for the layout placeholder has correctly been assigned to the signer in end package. Also note that the layout has still applied it's signatures to signers of the package even though the placeholders used in lines 15 and 29 have neither the same ID or name.