Sending Multiple Document using webclient in c# not working
Sunday, February 10, 2019 at 01:48amHi Duo,
I am not able to send the multiple pdf doc using webClient during creating Package with binary doc by the Rest Api,
can you provide me the working code for the sending multiple doc for the multiple signers using webclient(For Rest Api).
Reply to: Sending Multiple Document using webclient in c# not working
Sunday, February 10, 2019 at 03:07amHi Kartik, Have you tried the code in this thread?
using (WebClient wc = new WebClient()) { var URI = new Uri("https://sandbox.esignlive.com/api/packages"); var MULTIPART_BOUNDARY = "----WebKitFormBoundary7MA4YWxkTrZu0gW"; wc.Headers["Content-Type"] = "multipart/form-data; boundary=" + MULTIPART_BOUNDARY; wc.Headers["Accept"] = "application/json"; wc.Headers["Authorization"] = "Basic your_API_Key"; var postData = new StringBuilder(); string jsonString = "......"; postData.Append("--" + MULTIPART_BOUNDARY + "\r\n"); postData.Append("Content-Disposition: form-data; name=\"file\"; filename=\"file1.pdf\"\r\n"); postData.Append("Content-Type: application/pdf\r\n\r\n"); postData.Append(System.Text.Encoding.Default.GetString(File.ReadAllBytes("your_file_path"))); postData.Append("--" + MULTIPART_BOUNDARY + "\r\n"); postData.Append("Content-Disposition: form-data; name=\"file\"; filename=\"file2.pdf\"\r\n"); postData.Append("Content-Type: application/pdf\r\n\r\n"); postData.Append(System.Text.Encoding.Default.GetString(File.ReadAllBytes("your_file_path"))); postData.Append("\r\n\r\n"); postData.Append("--" + MULTIPART_BOUNDARY + "\r\n"); postData.Append("Content-Disposition: form-data; name=\"payload\"\r\n\r\n"); postData.Append(jsonString); postData.Append("\r\n\r\n"); postData.Append("--" + MULTIPART_BOUNDARY + "--"); wc.UploadString(URI, "POST", postData.ToString());This is the part that may interest you. Duo
Reply to: Sending Multiple Document using webclient in c# not working
Sunday, February 10, 2019 at 03:49amReply to: Sending Multiple Document using webclient in c# not working
Sunday, February 10, 2019 at 04:10amReply to: Sending Multiple Document using webclient in c# not working
Sunday, February 10, 2019 at 05:53amReply to: Sending Multiple Document using webclient in c# not working
Sunday, February 10, 2019 at 01:37pmcatch (WebException webex) { WebResponse errResp = webex.Response; using (Stream respStream = errResp.GetResponseStream()) { StreamReader reader = new StreamReader(respStream); string text = reader.ReadToEnd(); Debug.WriteLine("error message: " + text); } }Or more directly, can you use HTTP monitor tools like Fiddler to catch your HTTP outbound requests(fiddler is easy to use if you were developing with Windows)? It would be much easier to analyze reasons if we can see the raw HTTP request and the error message OneSpan Sign returns to you. Duo