Hi Guys,
I am trying to access a webservice that requires client certificate for authentication. The client has sent us the certificate(.p12) along with the password, and I have installed the certificate under my local machine store as explained in the following article.
http://support.microsoft.com/kb/901183.
Using WSE2.0 I am also able to pull the certificate using the following code:
// WSE 2.0 method
X509CertificateStore store =
X509CertificateStore.LocalMachineStore(X509CertificateStore.MyStore);
store.OpenRead();
// Look for the first certificate that is named SecureMathClient.
// Look in the local machine store.
X509CertificateCollection col=
(X509CertificateCollection)store.FindCertificateBySubjectString(certName);
X509Certificate cert =null;
try
{
// This sample obtains the first matching certificate from the collection.
cert = col[0];
}
catch(Exception ex)
{
throw new Exception("Certificate not Found!");
}
What I want now is how to access the webservice by passing the client certificate through my .net web application. I cannot add reference to the webservice by using Add Webreference because I get an error saying that particular webservice requires a certificate.
Some of the code samples I am refering to keeps talking about creating a webservice proxy. How do i create the proxy when i cannont add the reference to the webservice?
Thank you all in advance for your help