Install the Self-Signed Certificate:
Ensure that the self-signed certificate is installed in the Trusted Root Certification Authorities store on the machine where the code is running. This can help the system recognize the certificate as trusted.
Bypass SSL Validation:
While not recommended for production environments due to security risks, you can bypass SSL validation for testing purposes. In AL, you can use the HttpClient to ignore SSL errors by setting the ServerCertificateCustomValidationCallback property.
Here’s an example of how you might modify your code to bypass SSL validation:
client := HttpClient.Create();
client.DefaultRequestHeaders.Add('SOAPAction', 'Login');
client.ServerCertificateCustomValidationCallback := (sender, cert, chain, sslPolicyErrors) => true;
content.WriteFrom(composeBody());
content.GetHeaders(headers);
headers.Remove('Content-Type');
headers.Add('Content-Type', 'application/soap+xml; charset="utf-8"');
request.Method := 'POST';
request.SetRequestUri(gUrl);
request.Content := content;
if not client.Send(request, response) then
Error('Error en POST: %1', GetLastErrorText());
if not response.IsSuccessStatusCode then
Error('%1:%2', response.HttpStatusCode, response.ReasonPhrase);
response.Content.ReadAs(respuesta);
Message(respuesta);
Check Certificate Chain:
Ensure that the entire certificate chain is available and trusted. Sometimes intermediate certificates are missing, which can cause validation issues.
Revocation Check:
The error mentions RevocationStatusUnknown and OfflineRevocation. Ensure that the machine can access the Certificate Revocation List (CRL) endpoints. If the machine is offline or cannot reach these endpoints, it might fail the revocation check.
Use a Valid Certificate:
If possible, use a certificate issued by a trusted Certificate Authority (CA) instead of a self-signed certificate. This can avoid many of these issues.