Account


Earned badges

Achievement: Latest Unlocked

Topic Started

Topics
Apologies if this is a duplicate.

Replies Created

Reply to: Asynchronous Document Upload

0 votes
Thank you for the response harishaidary, much appreciated. Unfortunately, this does not solve our issue. Currently we experience slow performance from createPackage and createPackageOneStep when package sizes are large (8+ documents). One workaround we see to this is to create the package and obtain the Id first. This way we can perform business functions relating to the package while documents are being uploaded asynchronously. This has a faster response time for clients and overall would have better performance of the system. Is there a way to workaround this 'limit' being placed on the documentPackage?

Reply to: Asynchronous Document Upload

0 votes
Thanks for the quick turn around. I believe the "null" issue is a red herring. The java SDK covers up the actual errors that have occurred during create/upload a. During serialization, the JSON cannot be converted into a pojo if it was an error message. b. Instead, it throws an InvalidArgumentException due to the fact a required field is missing. (See below) In PackageService.java
    public com.silanis.esl.sdk.Document uploadApiDocument( String packageId, String fileName, byte[] fileBytes, Document document ) {
        String path = template.urlFor(UrlTemplate.DOCUMENT_PATH)
                              .replace("{packageId}", packageId)
                              .build();

        String documentJson = Serialization.toJson(document);

        try {
            String response = client.postMultipartFile(path, fileName, fileBytes, documentJson);
             //This will error because failure Json responses won’t be a document.
            com.silanis.esl.api.model.Document uploadedDocument = Serialization.fromJson(response, com.silanis.esl.api.model.Document.class);              return new DocumentConverter(uploadedDocument, getApiPackage(packageId)).toSDKDocument();
        } catch (RequestException e) {
            throw new EslServerException("Could not upload document to package.", e);
        } catch (Exception e) {
          //Creating a new exception here hides the original cause that can be found in the String ‘response’.
            throw new EslException("Could not upload document to package.", e);         }
    }
However, this may be a topic for another thread. I've marked your answer as accepted.

Subscriptions

Topics Replies Freshness Views Users
Apologies if this is a duplicate.
4 6 years 8 months ago 26
Profile picture for user harishaidary

Code Share

This user has not submitted any code shares.

Subscriptions Release Notes

This user is not subscribed to any release notes.