GetUpdatedPackagesWithinDateRange Unhandled Exception
Wednesday, March 22, 2017 at 07:07amI'm having some difficulty implementing DownloadDocumentsDateRange posted previously in this forum. When the following code is executed the EslClient.PackageService.GetUpdatedPackagesWithinDateRange function throws an unhandled exception stating that an unexpected character was encountered while parsing value. I assume the string it's trying to parse is the response from eSignLive but I'm at a loss on how to debug it. Is there a way to capture and view this response? Is there documentation on the EslClient class that could shed light on what value the GetUpdatedPackagesWithinDateRange is expecting?
using System; using System.IO; using System.Threading; using Silanis.ESL.SDK; using System.Diagnostics; using Silanis.ESL.SDK.Builder; namespace DownloadDocumentsDateRange { class DownloadDocuments { public static void Main(string[] args) { //API Identification Strings String apiUrl = "https://sandbox.esignlive.com/api"; String apiKey = "***Redacted***"; //Proxy info string httpProxyURL = "***Redacted***"; int httpProxyPort = ***Redacted***; //Build Proxy Configuration ProxyConfiguration httpProxyConfiguration = ProxyConfigurationBuilder.NewProxyConfiguration() .WithHttpHost(httpProxyURL) .WithHttpPort(httpProxyPort) .Build(); //Set EslClient EslClient eslClient = new EslClient(apiKey, apiUrl, httpProxyConfiguration); //starting point to retrieve completed packages int index = 1; //Retrieve first 50 completed packages. Packages are returned as a page from eSignLive. PageHere's the full stack trace.completedPackages = eslClient.PackageService.GetUpdatedPackagesWithinDateRange(DocumentPackageStatus.COMPLETED, new PageRequest(index, 50), DateTime.Today.AddDays(-30), DateTime.Now); while (index = completedPackages.TotalElements) { foreach (DocumentPackage package in completedPackages) { //for each completed package, get the package id to download signed documents. Debug.WriteLine("Downloading package: " + package.Id + "..."); byte[] zipContent = eslClient.DownloadZippedDocuments(package.Id); File.WriteAllBytes("C:\\" + package.Id.ToString() + ".zip", zipContent); index++; Thread.Sleep(1000); } //Retrieve next 50 packages completedPackages = eslClient.PackageService.GetUpdatedPackagesWithinDateRange(DocumentPackageStatus.COMPLETED, new PageRequest(index, 50), DateTime.Today.AddDays(-30), DateTime.Now); } Debug.WriteLine("Downloaded All File!"); } } }
Silanis.ESL.SDK.EslException was unhandled HResult=-2146233088 Message=Could not get package list. Exception: Unexpected character encountered while parsing value: . Path '', line 0, position 0. Source=Silanis.ESL StackTrace: at Silanis.ESL.SDK.Services.PackageService.GetUpdatedPackagesWithinDateRange(DocumentPackageStatus status, PageRequest request, DateTime from, DateTime to) at DownloadDocumentsDateRange.DownloadDocuments.Main(String[] args) in ***Redacted***:line 39 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: HResult=-2146233088 LineNumber=0 LinePosition=0 Message=Unexpected character encountered while parsing value: . Path '', line 0, position 0. Path="" Source=Newtonsoft.Json StackTrace: at Newtonsoft.Json.JsonTextReader.ParseValue() at Newtonsoft.Json.JsonTextReader.ReadInternal() at Newtonsoft.Json.JsonTextReader.Read() at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType(JsonReader reader, JsonContract contract, Boolean hasConverter) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) at Silanis.ESL.SDK.EslServerException..ctor(String message, String errorDetails, WebException cause) at Silanis.ESL.SDK.Internal.HttpMethods.GetHttpJson(String apiToken, String path, String acceptType) at Silanis.ESL.SDK.RestClient.Get(String path) at Silanis.ESL.SDK.Services.PackageService.GetUpdatedPackagesWithinDateRange(DocumentPackageStatus status, PageRequest request, DateTime from, DateTime to) InnerException:Thanks for taking a look!
Reply to: GetUpdatedPackagesWithinDateRange Unhandled Exception
Thursday, March 23, 2017 at 06:40amReply to: GetUpdatedPackagesWithinDateRange Unhandled Exception
Wednesday, March 22, 2017 at 08:51amReply to: GetUpdatedPackagesWithinDateRange Unhandled Exception
Thursday, March 23, 2017 at 05:58amReply to: GetUpdatedPackagesWithinDateRange Unhandled Exception
Thursday, March 23, 2017 at 07:19amReply to: GetUpdatedPackagesWithinDateRange Unhandled Exception
Thursday, March 23, 2017 at 07:51amReply to: GetUpdatedPackagesWithinDateRange Unhandled Exception
Thursday, March 23, 2017 at 07:51amReply to: GetUpdatedPackagesWithinDateRange Unhandled Exception
Thursday, March 23, 2017 at 07:55am