I mocked web-service via SoapUI 4.6.2, that service is client side authenticated.
I tried to connect to the service by the following code:
ServicePointManager.CertificatePolicy = new MyCertificateValidation();
MyService.Url = "https://MyIP:9988/mockService?WSDL";
NetworkCredential netCred = new NetworkCredential(
"User", "password");
ICredentials credentials = netCred.GetCredential(MyService.Url, "Basic");
MyService.Credentials = credentials;
MyService.PreAuthenticate = true;
var resp = MyService.GetXmlObject();
And this is the definition for MyCertificateValidation() :
class MyCertificateValidation : ICertificatePolicy
{
private const uint CERT_E_UNTRUSTEDROOT = 0x800B0109;
public MyCertificateValidation()
{}
public bool CheckValidationResult(ServicePoint sp, X509Certificate cert, WebRequest req, int problem)
{
bool returnValue = true;
if((uint)problem == CERT_E_UNTRUSTEDROOT)
{
returnValue = true;
}
return returnValue;
}
}
Issue is i am getting the "Could not establish secure channel for SSL/TLS" exception while trying to sent request to the server.
And this is the stackTrace:
at System.Net.HttpWebRequest.finishGetResponse()
at System.Net.HttpWebRequest.GetResponse()
at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.SoapHttpClientProtocol.doInvoke(String methodName, Object[] parameters, WebClientAsyncResult asyncResult)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
I am making the app for Windows mobile 6.5.