2% to 3% of total portal worldcheckone call/requests are getting failed with below connection issues to dev worldcheckone server
- Unable to connect to the remote server
- The underlying connection was closed: An unexpected error occurred on a receive.
- The underlying connection was closed: A connection that was expected to be kept alive was closed by the server.
- The remote server returned an error: (503) Server Unavailable.
- The remote server returned an error: (400) Bad Request.
Is there any known solution for this type of connection issues?
Below is the sample code snippet for call/request
----------------------------------------------------------------------------------------
string date = dateValue.ToString("R"); // WC1 header requires GMT datetime stamp
string requestendpoint = "https://" + GateWayHost + GateWayUrl + "cases/" + CaseSystemID + "/screeningRequest";
string postData = "{\"customFields\":[],\"providerTypes\":[\"WATCHLIST\"]}";
string msg = postData;
string dataToSign = "(request-target): post " + GateWayUrl + "cases/" + CaseSystemID + "/screeningRequest" + "\n" +
"host: " + GateWayHost + "\n" + // no https only the host name
"date: " + date;
string hmac = generateAuthHeader(dataToSign, APISecret);
string authorisation = "Signature keyId=\"" + APIKey + "\",algorithm=\"hmac-sha256\",headers=\"(request-target) host date\",signature=\"" + hmac + "\"";
//Defining TLS
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
| SecurityProtocolType.Tls11
| SecurityProtocolType.Tls12
| SecurityProtocolType.Ssl3;
//END
// Send the Request to the API server
HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create(requestendpoint);
// Set the Headers
WebReq.Method = "POST";
WebReq.Headers.Add("Authorization", authorisation);
WebReq.Headers.Add("Cache-Control", "no-cache");
WebReq.Date = dateValue; // use datetime value GMT time
using (HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse())
{ // Status information about the request
if (WebResp.StatusCode.ToString() == "Created")
{
str = WC1CaseAuditEventRequest(requestObj, request, calledBy, quoteId, historyId, partyType, CaseSystemID, dateValue);
}
}
----------------------------------------------------------------------------------------