2

URL から XML を取得し、そこからデータを電話で表示する方法を確認するためのチュートリアルのあるページを見ていましたが、http 接続しか見つかりませんでした。

URL からデータを取得する必要がありますが、http を使用してサーバーに接続できません https を使用する必要があります

try {

            DefaultHttpClient httpClient = new DefaultHttpClient();

            HttpPost httpPost = new HttpPost("https:...");

            HttpResponse httpResponse = httpClient.execute(httpPost);
            HttpEntity httpEntity = httpResponse.getEntity();
            line = EntityUtils.toString(httpEntity);

            line = con.getResponseMessage();
            //con.getResponseMessage();
        } catch (UnsupportedEncodingException e) {
            line = "<results status=\"error\"><msg>Can't connect to server</msg></results>";
        } catch (MalformedURLException e) {
            line = "<results status=\"error\"><msg>Can't connect to server</msg></results>";
        } catch (IOException e) {
            line = "<results status=\"error\"><msg>Can't connect to server</msg></results>";
        }

このフラグメントを https を使用するように変更するにはどうすればよいですか? https から xml を取得するチュートリアルはありますか?

4

1 に答える 1

1

このページを使用して、サーバーに接続し、https で XML を取得するソリューションを見つけました : https://secure.mcafee.com/us/resources/white-papers/wp-defeating-ssl-cert-validation.pdf

于 2012-08-29T10:01:33.993 に答える