Account
I am a
Developer
Product(s)
Earned badges
Achievement: Latest Unlocked
Approved Answers
Replies
Topics Started
Preferences
Profile Completion
Topic Started
Topics |
---|
PackageId packageId = client.createPackage(superDuperPackage3);
This works on Windows but when I run it on a MAC I get an EslException with a getLocalizedMessage() of "Could not create a new package"
|
I am new to the eSign process and need to be able to download a completed PDF document not a zip file with the document in it.
|
Replies Created
Reply to: Can't find the documentid
Wednesday, November 15, 2017 at 05:46amHaris,
Thank you for your quick reply.
The .WithId(documentId) worked quite well.
I also tried to download the PDF document through the DocumentPackage as you suggested and was successful, but I am not sure it is the most efficient way. This is what I did:
DocumentPackage docPackage = client.getPackage(packageId);
List edocs = new ArrayList();
edocs = docPackage.getDocuments();
Iterator iterEdocs = edocs.iterator();
Document edoc = null, edocument = null;
while (iterEdocs.hasNext()) {
edoc = iterEdocs.next();
edocument = docPackage.getDocument(edoc.getName());
}
byte[] documentContent = client.downloadDocument(packageId, edocument.getId().toString());
Files.saveTo(documentContent, "C:/SampleEsignDocumentContent.pdf");
Reply to: EslClient createPackage not working on MAC
Friday, November 24, 2017 at 08:41amHaris,
This is the error I am getting:
Exception in thread "main" java.lang.NoSuchFieldError: INSTANCE
at org.apache.http.impl.client.HttpClientBuilder.build(HttpClientBuilder.java:769)
at com.silanis.esl.sdk.internal.RestClient.buildHttpClient(RestClient.java:243)
at com.silanis.esl.sdk.internal.RestClient.execute(RestClient.java:176)
at com.silanis.esl.sdk.internal.RestClient.post(RestClient.java:105)
at com.silanis.esl.sdk.service.PackageService.createPackage(PackageService.java:50)
at com.silanis.esl.sdk.EslClient.createPackage(EslClient.java:266)
at eSignature.TextAnchor.main(TextAnchor.java:79)
I have attached my Java code.
Approved Answer
Reply to: EslClient createPackage not working on MAC
Friday, November 24, 2017 at 08:43amTry sending file again
Reply to: EslClient createPackage not working on MAC
Friday, November 24, 2017 at 08:45amWon't let me send a file so here is the code:
package com.esignlive.example;
import static com.silanis.esl.sdk.builder.DocumentBuilder.newDocumentWithName;
import static com.silanis.esl.sdk.builder.PackageBuilder.newPackageNamed;
import static com.silanis.esl.sdk.builder.SignatureBuilder.signatureFor;
import static com.silanis.esl.sdk.builder.SignerBuilder.newSignerWithEmail;
import java.io.PrintStream;
import java.util.Date;
import com.silanis.esl.sdk.DocumentPackage;
import com.silanis.esl.sdk.EslClient;
import com.silanis.esl.sdk.EslException;
import com.silanis.esl.sdk.PackageId;
import com.silanis.esl.sdk.TextAnchorPosition;
import com.silanis.esl.sdk.builder.TextAnchorBuilder;
import com.silanis.esl.sdk.internal.EslServerException;
public class TextAnchor {
private static final PrintStream o = System.out;
//replace api_key placeholder with your own value
private static final String API_KEY = "TmlBSGdOWENQQnNOOkZacDRWNEZiY2UwQg==";
public static final String API_URL = "https://sandbox.esignlive.com/api";
public static String clientEmail = null, clientLN = null, clientFN = null;
public static String contrEmail = null, contrLN = null, contrFN = null;
public TextAnchor(String clem, String clln, String clfn, String coem, String coln, String cofn) {
clientEmail = clem;
clientLN = clln;
clientFN = clfn;
contrEmail = coem;
contrLN = coln;
contrFN = cofn;
}
public static void main(String[] args) {
try {
new TextAnchor("[email protected]", "Eldred", "Mike", "[email protected]", "Cathro", "Paul"); //clientEmail = "[email protected]";
o.println("Client Email\t\t=\t" + clientEmail);
o.println("Client First Name\t=\t" + clientFN);
o.println("Client Last Name\t=\t" + clientLN);
o.println("Contractor Email\t\t=\t" + contrEmail);
o.println("Contractor First Name\t=\t" + contrFN);
o.println("Contractor Last Name\t=\t" + contrLN);
EslClient client = new EslClient(API_KEY, API_URL);
//DocumentPackage superDuperPackage3 = newPackageNamed("02/02/2017 HCS WIN Comm")
DocumentPackage superDuperPackage3 = newPackageNamed("Text Anchor Extraction Example Java SDK")
.expiresAt( DateUtil.addDays(new Date(), 90) )
.withSigner(newSignerWithEmail(clientEmail)
.withFirstName(clientFN)
.withLastName(clientLN)
.withEmailMessage("This is an example of adding custom text to the e-Signature email-Client\r\n\r\nWhatcha think Mike????")
//.withCustomId("client")
.signingOrder(2))
.withSigner(newSignerWithEmail(contrEmail)
.withFirstName(contrFN)
.withLastName(contrLN)
.withEmailMessage("This is an example of adding custom text to the e-Signature email-IBM")
//.withCustomId("contractor")
.signingOrder(1))
//.withDocument(newDocumentWithName("02/02/2017 HCS WIN Comm")
.withDocument(newDocumentWithName("Sample Contract")
.withId("CustDocID00001")
.fromFile("/Users/cathrop/Documents/ITSEXPPRUSME68S93115CLETTER.pdf")
//.fromFile("C:\\$User\\GTS\\ITS Express\\e-signature\\cleaning_contract.pdf")
//.fromFile("C:\\$User\\GTS\\ITS Express\\e-signature\\ITSEXPPRUSME68S93115CLETTER.pdf")
.enableExtraction()
.withSignature(signatureFor(clientEmail)
.withPositionAnchor(TextAnchorBuilder.newTextAnchor("Authorized signature-Client")
.atPosition(TextAnchorPosition.TOPLEFT)
.withSize(150, 40)
.withOffset(0, -50)
.withCharacter(0)
.withOccurence(0)))
.withSignature(signatureFor(contrEmail)
.withPositionAnchor(TextAnchorBuilder.newTextAnchor("Authorized signature-IBM")
.atPosition(TextAnchorPosition.TOPLEFT)
.withSize(150, 40)
.withOffset(0, -50)
.withCharacter(0)
.withOccurence(0))))
.build();
PackageId packageId = client.createPackage(superDuperPackage3);
o.println("packageId\t=\t" + packageId);
// Send the package to be signed by the participants
client.sendPackage(packageId);
} catch (EslServerException eslServerException) {
getEslServerException(eslServerException);
} catch (EslException eslException) {
getEslException(eslException);
} catch (Exception ex) {
getException(ex);
} finally {
getFinally();
}
}
private static void getException(Exception ex) {
o.println("Caught a: " + ex.getClass().getName());
o.println("Message: " + ex.getMessage());
o.println("Stacktrace follows:.....");
ex.printStackTrace(o);
}
private static void getFinally() {
try {
System.gc();
} catch (Exception e) {
e.printStackTrace(o);
}
}
private static void getEslServerException(EslServerException eslServerException) {
// The request was refused by the server for some reason...
o.println(eslServerException.getLocalizedMessage());
o.println(eslServerException.getServerError().getCode().toString());
o.println(eslServerException.getServerError().getMessage());
o.println(eslServerException.getServerError().getTechnical());
}
private static void getEslException(EslException eslException) {
o.println(eslException.getLocalizedMessage());
o.println(eslException.getCause().getMessage());
o.println(eslException.getMessage());
}
}
Reply to: EslClient createPackage not working on MAC
Monday, November 27, 2017 at 10:32amAm at JDK 1.8 and was using SDK 11.5 (sdk-11.5-jar-with-dependencies) so downloaded 11.8 (sdk-11.8-jar-with-dependencies) and added it to my Buildpath (using Eclipse).
Still get the same error:
Exception in thread “main†java.lang.NoSuchFieldError: INSTANCE
at org.apache.http.impl.client.HttpClientBuilder.build(HttpClientBuilder.java:769)
at com.silanis.esl.sdk.internal.RestClient.buildHttpClient(RestClient.java:243)
at com.silanis.esl.sdk.internal.RestClient.execute(RestClient.java:176)
at com.silanis.esl.sdk.internal.RestClient.post(RestClient.java:105)
at com.silanis.esl.sdk.service.PackageService.createPackage(PackageService.java:50)
at com.silanis.esl.sdk.EslClient.createPackage(EslClient.java:266)
at eSignature.TextAnchor.main(TextAnchor.java:79)
Subscriptions
Topics | Replies | Freshness | Views | Users |
---|---|---|---|---|
PackageId packageId = client.createPackage(superDuperPackage3);
This works on Windows but when I run it on a MAC I get an EslException with a getLocalizedMessage() of "Could not create a new package"
|
7 | 6 years 5 months ago | 56 | |
I am new to the eSign process and need to be able to download a completed PDF document not a zip file with the document in it.
|
3 | 6 years 5 months ago | 12 |
Subscriptions Release Notes
This user is not subscribed to any release notes.