I've got a big problem. I've to POST to an URL some parameters from my application. But when I try to do it within a WebView object it trows me an exception that says "Untrusted Certicate" (the exception is trown by the method in override of the WebViewClient onReceivedSslError()). How can I be able to handshake correctly with the server? Could you please give me some tips? I'm getting crazy...
Really, really thanks...
EDIT: this is how I've defined my webview
webView = (WebView) myFragmentView.findViewById(R.id.webView);
webView.setWebViewClient(new WebViewClient(){
@Override
public void onPageFinished(WebView view, String string){
Log.debug(tag, "URL pagina terminata :"+webView.getUrl() );
if(progress!=null)
if(progress.isShowing()){progress.dismiss();}
}
@Override
public void onReceivedError(WebView view,
int errorCode,
String description,
String failingUrl) {
Log.error(tag, "ERROR:" + description );
}
@Override
public void onReceivedSslError(WebView view,
SslErrorHandler handler, SslError error) {
super.onReceivedSslError(view, handler, error);
Log.error(tag, "SSL Error received: "+ error.getPrimaryError());
handler.proceed();
}
});
This is how I've created a postRequest within a WebView
webView.postUrl(url, EncodingUtils.getBytes(postParameters, "base64"));
This is the LogCat output:
SSL Error received: 3 - Untrusted Certificate
Now, googling a little bit I've seen that there's the need to check the validity of the certificate and to import the keychain into a local keystore. But the problem is that I'0 don't know where to start... :)