I am really hoping that someone here can help. Let me also preface my question by saying that I am not a .NET expert and have very little experience with web services and SSL/security issues.
I am trying to create a VB .NET console application to consume a Java-based web service hosted on an Apache server. Communication is taking place over SSL. A client certificate is required (provided by web service providers) and basic authentication (username/password) is also required to consume the service.
In installed the certificate (using certmgr.mgr) from a provided PFX file and have the certificate stored in both my Personal store and Trusted Root store. I did not check off any checkboxes for strong encryption (used defaults for everything).
I created a proxy class for the service using a provided WSDL file. The WSDL that resides on their server is not correct and could not be used for early binding in .NET. I created the proxy class using "SVCUTIL *.wsdl /language:VB".
I am getting the following error when trying to call one of the exposed methods from the service:
An error occurred while making the HTTP request to "https://webservice-url?WSDL". This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server.
If I look at the InnerException from the Exception snapshot, I see the following:
The underlying connection was closed: An unexpected error occurred on a send.
Here is the code that I've used to initialize the client and connect to the web service:
'Override server certificate callback
Dim oCertOverride As New CertificateOverride
ServicePointManager.ServerCertificateValidationCallback = _
AddressOf oCertOverride.RemoteCertificateValidationCallback
'Set WS binding
Dim binding As WSHttpBinding = New WSHttpBinding
binding.Security.Mode = SecurityMode.Transport
binding.Security.Transport.ClientCredentialType = _
HttpClientCredentialType.Certificate
'Set endpoint address
Dim address As EndpointAddress = _
New EndpointAddress("https://webservice-url?WSDL")
'Create web service client
Dim ws As wsclient = New wsclient(binding, address)
'Set web service client certificate
ws.ClientCredentials.ClientCertificate.SetCertificate(StoreLocation.CurrentUser, _
StoreName.My, X509FindType.FindBySubjectName, "cert-subject-name")
'Set username and password for server authentication
ws.ClientCredentials.UserName.UserName = "username"
ws.ClientCredentials.UserName.Password = "password"
'Make test call to web service
ws.HelloWord()
I should also mention that I can connect to the web service and view all exposed methods using Firefox and IE.
I've been scouring the Internet for help. Most of the quick fixes that have worked for people have not helped. I've played around with the binding settings but that has only resulted in various errors about being unable to connect to the web service using the "Anonymous" user account.
I'm really at a loss. Any tips or help would be greatly appreciated.
Thank you for your time.