I have a C# .NET client (2.0 Framework) that needs to connect to a java web service (built with Axis) and send some data for processing. The java web service is hosted on a secured Apache server ( I am not in control of this server or web service).
I can create a web reference using VS2005 with the https URL of the WSDL file. When I try sending the data I receive the below error:
"Unable to connect to the remote server"
I added the below function to allow all server certificates.
public static bool ValidateServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
return true;
}
I then make the below call before sending my values to the web service.
ServicePointManager.ServerCertificateValidationCal lback = new RemoteCertificateValidationCallback(ValidateServer Certificate);
I'm not sure if I missed something else or if the problem is not on my end at all.
Any help will be greatly appreciated.
Loading
SubashPosted Sep 18, 2009, 9:50 PM
mohamedPosted Jun 29, 2009, 6:21 AM
I'm facing the same problem now, i tried to follow your steps but i couldn't understand whats the Certificate ?
can you please post the exact and complete code to use.
Thanking you in advance
Posted Jul 28, 2008, 6:53 AM
Use following code for secure URL This code is in vb.net
Dim certfile As System.Security.Cryptography.X509Certificates.X509Certificate
certfile = System.Security.Cryptography.X509Certificates.X509Certificate.CreateFromCertFile(CertificatePath)
obj_WebService.ClientCertificates.Add(certfile)
obj_WebService is the object of web service. Install the certificate on your computer also
If web service uses WS-Security then in the request header you have to send the user id and password also.