以下のコードが失敗することもあれば、うまくいくこともあります。私はJava8を使用しています。サーバー側の問題ですか?
スレッド「メイン」での例外 javax.net.ssl.SSLException: サポートされていないレコード バージョン Unknown-0.0.
編集: JDK8 から JDK7 にダウングレードすると、動作します。私が見つけた唯一の解決策は機能します。
public static void main(String[] args) throws Exception {
URL u = new URL("https://c********.web.cddbp.net/webapi/xml/1.0/");
HttpURLConnection connection = (HttpURLConnection) u.openConnection();
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setInstanceFollowRedirects(false);
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "text/plain");
connection.setRequestProperty("charset", "utf-8");
connection.setRequestProperty("Content-Length", "" + 140);
connection.setUseCaches(false);
DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
}