Im trying to consume a Web Service from winforms (no ASP) which has develop SSL security in VB .Net . Once I've loaded the WSDL file, I can see the available resources and add the as a web reference. But when I try to execute a method from the service, I get the error: "THE UNDERLYING CONNECTION WAS CLOSED. EUNABLE TO CONNECT TO REMOTE SERVER". Now, Im pretty sure it's got something to be with certificate. I have the user name and password, but how can I code this part to be authorize for the certificate I have a cacert file which authenticates my user and pwd, but I really don't know how to write it down.
I tried the same service but this time its uploaded to a normal not SSL server. I can add the service, I can use it without defining the credentials. Which its logical since the client built by .Net does all the job. Is it the same thing with SSL Can anyone help me Code example will be great.
Thanks all of ya!
JP

consuming SSL web service!
Ben Shemmeld
Hi Josue,
Which version of .NET Framework are you using The thing is that the code in the link you provided is oboslete in .NET Framework version 2.0.
Regrads,
Uros
Gordon Watts
There is good documentation on how to use certificates in the msdn help documentation. Look at the ClientCertificates property of the HTTPWebClientProtocol class. If you have the certificate file you can load it via the code below:
// Create a new instance of a proxy class for the Bank XML Web service.
BankSession bank = new BankSession();
// Load the client certificate from a file.
X509Certificate x509 = X509Certificate.CreateFromCertFile(@"c:\user.cer");
// Add the client certificate to the ClientCertificates property of the proxy class.
bank.ClientCertificates.Add(x509);
// Communicate with the Deposit XML Web service method,
// which requires authentication using client certificates.
bank.Deposit(500);
Hope this helps
smc750
zarkorgon
Thanks smc!
I have not yet tried your code. I used the next link where it explains how to deploy HTTPS on web services.
http://weblogs.asp.net/jan/archive/2003/12/04/41154.aspx
It worked like a charm for me.
Thanks for your help
Kenneth Davidsen
Sorry for not answering before.
The framework version is 1.1, since I'm using VB 2003 this worked like for me.
Regards,
JP