我想从我的服务器发送POST请求到我的另一台服务器。它在http上运行良好,当通过https执行时,它表示内部服务器错误 - 服务器发生意外的文件结束。这是我的HTTPS POST代码。发送帖子通过HTTPS - 不工作
URL url = new URL("https://.../Action")
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
System.out.println("Connection established");
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.setRequestProperty("Content-Length", String.valueOf(postDataBytes.length));
conn.setDoOutput(true);
conn.getOutputStream().write(postDataBytes);
//Error in the following line
in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
`
您的另一台服务器配置正确的https?你可以使用https从浏览器中打开它。 –
是的。我可以通过浏览器中的HTTPS访问这两个服务器。 – Anand
日志在另一边说什么。你可以发布吗? –