'Delphi - problem with consuming SOAP with x509 certificate authentication
We should use a SOAP web service that is written in c# with Delphi 10.4.2 OR 11.0
related WSDL file successfully imported and the Delphi related code is generated no problem. the problem is we should use x509 certificate as authentication method but webservice is on HTTP not HTTPS
first we install certificate on local machine and use certificate in HTTPRIO.HTTPWebNode.ClientCertificate by its serial number and call a method with no success. server just close the connection with 0 length reply.
after that we receive a simple working code in c#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GeneralUtilityService.GeneralUtilityServiceSR;
using System.Security.Cryptography.X509Certificates;
using System.ServiceModel.Security;
namespace GeneralUtilityServiceProject
{
class Program
{
static void Main(string[] args)
{
GeneralUtilityService client = new GeneralUtilityService();
client.ClientCredentials.ServiceCertificate.DefaultCertificate = new X509Certificate2("d:/test/test.cer");
client.ClientCredentials.ClientCertificate.Certificate = new X509Certificate2("d:/test/test.p12", "123456", X509KeyStorageFlags.PersistKeySet);
client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
var result = client.getLastStatusOfEmployees("username","password");
var nn = result[0].lastStatusCheck;
Console.WriteLine(nn);
Console.ReadKey();
}
}
}
but i don't know its equivalent in Delphi to handle certificate like this
any helps would be appreciated
best regards
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
