Fares Ayyad

Fares Ayyad

  • NA
  • 235
  • 74.2k

adding certificate to SOAP web service.

May 13 2018 7:57 AM
Hello
 
I'm trying to call a webservice, which requires a certificate to work, the certeficate installed 
on local machine in mmc. 
 
 
i need to add a certificate using code to the web service instance. 
 
  1. NeqatyWSDL.NeqatyWSAPI neqatyWSAPI = new NeqatyWSDL.NeqatyWSAPI();  
  2. neqatyWSAPI.Url = "https://simb140.margento.com:48728";  
  3.   
  4. X509Certificate2 cert = new X509Certificate2(@"D:\cert.p12","pass",X509KeyStorageFlags.DefaultKeySet);  
  5.   
  6. neqatyWSAPI.ClientCertificates.Add(cert);  
  7.   
  8.   
  9.    neqatyWSAPI.authorize(authorize);  
The debugger stoped at the last line and raise error with the follwing:
 
The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. 

Answers (1)