有關於透過https 來post
首先我參考
http://stackoverflow.com/questions/2642777/trusting-all-certificates-using-httpclient-over-https
的方式,來自定義SSLSocketFactory
接著在主要POST的程式中
HttpClient httpclient = new DefaultHttpClient();
httpclient=MySSLSocketFactory.createMyHttpClient();
HttpPost httpPost = new HttpPost("https://xxxx");
StringEntity se = new StringEntity("paramterXXX",
HTTP.UTF_8);
httpPost.setEntity(se);
httpPost.setHeader("Accept", "application/json");
httpPost.setHeader("Content-type", "text/json");
// 8. Execute POST request to the given URL
HttpResponse httpResponse = httpclient.execute(httpPost);
// 9. receive response as inputStream
inputStream = httpResponse.getEntity().getContent();