퍼미션도 잘걸어줬도 경로도 잘확인했고..
앱에서 HttpURLConnection 를 이용해서 접속하려하면 responseCode 가 500 에러를 찍네요...
소스는 아래와 같이했습니다..
p.s HttpURLConnection.HTTP_OK 를 무시하고 해봤더니 FileNotFound가 뜨네요...파일은 잘있는데 어찌된건지..
try {
URL url = new URL(URL+ "?getOcode=" +ocode);
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
if (conn != null ) {
conn.setDoOutput( true );
conn.setDoInput( true );
conn.connect();
Log.e( "LOG4 getResponseCode" , conn.getResponseCode()+ " <==" );
if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {
isr = new InputStreamReader(conn.getInputStream(), "EUC-KR" ) ;
br = new BufferedReader(isr);
while ( true ) {
String line = br.readLine();
Log.e( "LOG4 line" , line+ " <===" );
if (line == null ) {
break ;
}
sBuffer.append(line+ "\n" );
line = null ;
}
conn.disconnect();
}
}
} catch (Exception e){
Log.e( "LOG4 error" , e.toString());
e.printStackTrace();
}
|