Unable to insert document with an existing package
Thursday, March 22, 2018 at 10:51amHi,
I am unable to insert document with an existing package. My sandbox api key and url work fine. But my company api key and url show errors.
My code:
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import com.silanis.esl.sdk.Document;
import com.silanis.esl.sdk.DocumentPackage;
import com.silanis.esl.sdk.DocumentType;
import com.silanis.esl.sdk.EslClient;
import com.silanis.esl.sdk.PackageId;
import com.silanis.esl.sdk.builder.DocumentBuilder;
public class DocumentUpload {
public static void main(String[] args) throws FileNotFoundException
{
System.setProperty("javax.net.ssl.trustStore","C:/Users/pl29158/myprojects/meao/srv/config/wspcerts.jks");
InputStream documentInputStream1= new FileInputStream("C://Users/pl29158/doc/sample_file2.pdf");
Document document = DocumentBuilder.newDocumentWithName("Example Document")
//.fromFile("C://Users/pl29158/doc/sample_file2.pdf")
.fromStream( documentInputStream1, DocumentType.PDF )
.withId("docuvment1")
.withDescription("Sample Document Description")
.build();
EslClient eslClient = new EslClient(Utility.API_KEY,Utility.BASE_URL);
DocumentPackage documentPackage = eslClient.getPackage(new PackageId("yDJEFQ60jEbNxB7AZ3L6yCBiOCU="));
eslClient.uploadDocument(document, documentPackage);
}
}
errors:
Exception in thread "main" com.silanis.esl.sdk.internal.EslServerException: Could not upload document to package. Exception: HTTP POST on URI https://e-signature-uat.pnc.com/a/api/packages/yDJEFQ60jEbNxB7AZ3L6yCBiOCU=/documents resulted in response with status code: [406, Not Acceptable]. Optional details: {"code":406,"entity":null,"message":"Not Acceptable","messageKey":"http.status.406","name":"Not Acceptable","technical":"","packageId":null,"messageLanguage":null}
at com.silanis.esl.sdk.service.PackageService.uploadApiDocument(PackageService.java:255)
at com.silanis.esl.sdk.service.PackageService.uploadDocument(PackageService.java:240)
at com.silanis.esl.sdk.EslClient.uploadDocument(EslClient.java:556)
at com.silanis.esl.sdk.EslClient.uploadDocument(EslClient.java:560)
at esignLiv.com.DocumentUpload.main(DocumentUpload.java:30)
Caused by: com.silanis.esl.sdk.internal.RequestException: HTTP POST on URI https://e-signature-uat.pnc.com/a/api/packages/yDJEFQ60jEbNxB7AZ3L6yCBiOCU=/documents resulted in response with status code: [406, Not Acceptable]. Optional details: {"code":406,"entity":null,"message":"Not Acceptable","messageKey":"http.status.406","name":"Not Acceptable","technical":"","packageId":null,"messageLanguage":null}
at com.silanis.esl.sdk.internal.RestClient.execute(RestClient.java:195)
at com.silanis.esl.sdk.internal.RestClient.postMultipartFile(RestClient.java:132)
at com.silanis.esl.sdk.service.PackageService.uploadApiDocument(PackageService.java:251)
... 4 more
Reply to: Unable to insert document with an existing package
Thursday, March 22, 2018 at 11:11amReply to: Unable to insert document with an existing package
Thursday, March 22, 2018 at 11:13am