Hi All;
I am new to Android. My requirement is save the data to MSSQL. I have
done using HttpClient.I want to know this HttpClient is secure.If i
want make a secure connection How can I take SSL certification. Please
guide me. This is my code :
HttpClient httpclient = getClient();
HttpPost httppost = new
HttpPost("http://192.xxx.x.xxx/android/
productInvoiceTest.php");
httppost.setEntity(new
UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
Intent intent = new Intent();
intent.setClass(this, InvoiceResult.class);
intent.putExtra("productName",
productName.getText().toString());
intent.putExtra("productId",
productId.getText().toString());
startActivity(intent);
public DefaultHttpClient getClient() {
DefaultHttpClient ret = null;
// sets up parameters
HttpParams params = new BasicHttpParams();
HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
HttpProtocolParams.setContentCharset(params, "utf-8");
params.setBooleanParameter("http.protocol.expect-continue",
false);
// registers schemes for both http and https
SchemeRegistry registry = new SchemeRegistry();
registry.register(new Scheme("http",
PlainSocketFactory.getSocketFactory(), 80));
final SSLSocketFactory sslSocketFactory =
SSLSocketFactory.getSocketFactory();
sslSocketFactory.setHostnameVerifier(SSLSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
registry.register(new Scheme("https", sslSocketFactory, 443));
ThreadSafeClientConnManager manager = new
ThreadSafeClientConnManager(params, registry);
ret = new DefaultHttpClient(manager, params);
return ret;
}
Please guide me whther this code is correct or not.
Thanks in advance.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en