SMS 게이트웨이에 연결하고 싶습니다. 다음 코드를 발견했습니다.자바에서 자체 서명 된 인증서 사용
public void smsSender(String username, String password, String to,
String text) throws IOException {
try {
String data = "username=" + username + "&password=" + password
+ "&to=" + to + "&text=" + text;
URL url = new URL("https://sendsms.abc.com:1010/sms.php");
HttpURLConnection urlc = (HttpURLConnection) url.openConnection();
urlc.setRequestMethod("POST");
urlc.setDoOutput(true);
urlc.setRequestProperty("Content-type",
"application/x-www-form-urlencoded");
BufferedWriter br = new BufferedWriter(new OutputStreamWriter(
urlc.getOutputStream()));
br.write(data);
br.flush();
BufferedReader rd = new BufferedReader(new InputStreamReader(
urlc.getInputStream()));
String line;
while (null != ((line = rd.readLine()))) {
output = line;
System.out.println(output);
}
rd.close();
} catch (Exception e) {
e.printStackTrace();
}
}
이 메서드를 사용하여 연결하려고하면 Eclipse에서 오류 메시지를 보냅니다.
수없는
요청 대상
난 자체 서명 인증서를 사용하고 액세스에 노력하고있어 서버에 유효한 인증 경로를 찾을 수 있습니다. 나는이 분야에 새로운 사람이다. 어떻게하면이 문제를 해결할 수 있습니다. 미리 감사드립니다 :)
아마도 유용 할 것입니다. http://stackoverflow.com/questions/859111/how-do-i-accept-a-self-signed-certificate-with-a-java-httpsurlconnection –