Reputation: 135
I have sent a request and got a response from a web service using with SOAPUI
To do this, i added my client certificate to SOAPUI -> Preferences -> SSL Settings
And it worked successfully. (I am getting ssl handshake error if i dont add keystore and password)
My problem is that i couldn't implement this (soapui keystore ability) in C# code. Below is my code and the error i get.
Upvotes: 0
Views: 1478
Reputation: 135
Finally i figured out the problem.
You should set the clientcertificate while creating the web service instance. By the way, ClientCredentials.ServiceCertificate.SslCertificateAuthentication options are for only ignoring the servercertificate is valid or not.
X509Certificate2 x509 = Utils.GetZBCertificate();
ClientCredentials.ServiceCertificate.SslCertificateAuthentication = new System.ServiceModel.Security.X509ServiceCertificateAuthentication();
ClientCredentials.ServiceCertificate.SslCertificateAuthentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None;
ChannelFactory.Credentials.ClientCertificate.Certificate = x509;
Upvotes: 0