docusign / docusign-esign-csharp-client

The Official Docusign C# Client Library used to interact with the eSignature REST API. Send, sign, and approve documents using this client.
https://developers.docusign.com/docs/esign-rest-api/sdks/csharp/
MIT License
129 stars 159 forks source link

Using SDK to connect to the API from a C# .Net Framework Web API #415

Closed nevillegauci closed 3 weeks ago

nevillegauci commented 1 year ago

Hi!

I am integrating Docusign into my C# Web API solution and I opted to use the SDK as a tool for the integration.

When I tried to make an authorization call to DocuSign, I was getting an error in line 1120 in the Class DocuSign.eSign.Client.DocuSignClient. DocuSignResponse docuSignResponse = RestClient.SendRequest(request);

The error was empty because the 'docuSignResponse.Content' was also empty so I had no clue where the issue was coming from. I took the same identical code and attempted to do an authorization from a console app and this worked fine.

Following the suggestion of Senior Support Manager Ivan Dinkov, I downloaded the SDK code and added it to my solution so I can debug it. Ultimately I found that the issue was that a TLS connection could not be established, however, I was not getting this error message but instead, I got an empty response. The problem is coming from the catch of the method SystemNetHttpClient.SendRequestAsync. because the real error was being masked by an empty 500 Internal Server Error with an empty response.Content.

It would be better if the actual error is returned instead of an empty string as I would have identified the issue immediately.

On the other hand, the actual issue was that the following code was missing and once I added it, it worked perfectly. ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11;

I added this in my code since I am using .Net Framework 4.6.2. Would it not be a good idea to add the security protocols in the SDK so that these are established for anyone using the SDK and trying to connect to the eSignature API from another API?

Thanks for your time!

esilva600 commented 1 year ago

Hello Neville,

We reached out to the Developers, and the Enhancement Ticket TIERBUGS-37647 was created to Enhance the Error Handling for the use case you reported. If you have any questions, you can reach out to the Support Team with this ticket.

Best,

garg-mudit commented 3 weeks ago

Hi @nevillegauci, I empathize with the challenges you faced while debugging the TLS issue. In our most recent update, we've enhanced our error-catching code to swiftly pinpoint the underlying issue. The release candidate for this update is scheduled for next week.

I will now close this ticket as the original issue has been resolved. Should you have any further questions or encounter new issues, please open a new ticket.

Thank You.