avassilev

Getting "Unexpected character encountered...." upon DownloadZippedDocuments

0 votes
Hi , Please assist with "Could not download the documents to a zip file. Exception: Unexpected character encountered while parsing value: <. path="" line="" position="" exception.="">Here's the code piece that produces error:
        public void downloadDocument(string packageId) {

            Logger.Info("DOWNLOADDOCUMENT");
            string fileLocation = string.Empty;

            try {
                var eslClient = new EslClient( C.OSS.API_KEY, C.OSS.API_URL);
                var pkgId = new PackageId( packageId);

                Logger.Info("C.OSS.API_KEY: " + C.OSS.API_KEY);
                Logger.Info("C.OSS.API_URL: " + C.OSS.API_URL);

                fileLocation = C.SIGNED_DOCUMENTS_STORAGE_PATH + "\\" + pkgId + "_" + DateTime.Now.ToString("yyyy_MM_dd") + "_" + Guid.NewGuid() + ".zip";
                byte[] content = eslClient.DownloadZippedDocuments( pkgId);

                Logger.Info("FILE SAVE PATH: " + fileLocation);
                File.WriteAllBytes( @fileLocation, content);
            } catch (Exception ex) {
                Logger.Error("EXCEPTION: " + ex.Message);
                Logger.Error("FILE SAVE PATH: " + fileLocation);
                throw;
            }
        }
Here's the trace from the above code: 2019-07-03 09:39:58,810 [10] INFO eSignListener.Controllers.CallbackController - RECEIVED CALLBACK 2019-07-03 09:39:58,857 [10] INFO eSignListener.Controllers.CallbackController - CALLBACK PAYLOAD: { "@class": "com.silanis.esl.packages.event.ESLProcessEvent", "name": "PACKAGE_CREATE", "sessionUser": "FEcgqb15yCME", "packageId": "unXAewAPSBSA5Nt3YZbqudP0ds0=", "message": null, "documentId": null, "createdDate": "2019-07-03T13:39:58.385Z" } 2019-07-03 09:39:58,857 [10] INFO eSignListener.Controllers.CallbackController - PROCESSED POST 2019-07-03 09:40:36,983 [8] INFO eSignListener.Controllers.CallbackController - RECEIVED CALLBACK 2019-07-03 09:40:36,983 [8] INFO eSignListener.Controllers.CallbackController - CALLBACK PAYLOAD: { "@class": "com.silanis.esl.packages.event.ESLProcessEvent", "name": "PACKAGE_COMPLETE", "sessionUser": "FEcgqb15yCME", "packageId": "unXAewAPSBSA5Nt3YZbqudP0ds0=", "message": null, "documentId": null, "createdDate": "2019-07-03T13:40:36.797Z" } 2019-07-03 09:40:36,983 [8] INFO eSignListener.Controllers.CallbackController - PROCESSED POST 2019-07-03 09:40:36,983 [8] INFO eSignListener.OssCallbackHandler - PACKAGE_COMPLETE 2019-07-03 09:40:36,983 [8] INFO eSignListener.OssService - DOWNLOADDOCUMENT 2019-07-03 09:40:36,999 [8] INFO eSignListener.OssService - C.OSS.API_KEY: xxxxxxxxxxxxx== 2019-07-03 09:40:36,999 [8] INFO eSignListener.OssService - C.OSS.API_URL: http://xxxxxx/api 2019-07-03 09:40:37,046 [8] ERROR eSignListener.OssService - EXCEPTION: Could not download the documents to a zip file. Exception: Unexpected character encountered while parsing value: <. path="" line="" position="" error="" esignlistener.ossservice="" file="" save="" path:="" e:="">

Approved Answer

Reply to: Getting "Unexpected character encountered...." upon DownloadZippedDocuments

1 votes
Hi avassilev, Yes, you also need the API Key for your sender. (enable integration feature in backoffice) And looks like your API_URL should use "esign.stage...com/api" instead of the callback url. Hope this could help! Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Getting "Unexpected character encountered...." upon DownloadZippedDocuments

0 votes
Hi there, For the first glance, I saw that your API_URL was not among any of the OneSpan Sign instance urls, are you using Reverse Proxy or On-Prem or you accidentally used callback URL instead? PS: I removed the API Key and URL for you.:) Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Getting "Unexpected character encountered...." upon DownloadZippedDocuments

0 votes
I'm using On-Prem stage server. In fact API Key is not available/missing - should I request admin to update configuration to have it available/visible? Attached is the screen shot of admin part. Many thanks!

Attachments

Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off