0
HTTP GET 메서드를 사용하는 JSON 클라이언트를 작성하려고하는데 응답이 500 건입니다. 시도한 코드가 아래에 있습니다. 같은 오류가 있습니까? 요청 매개 변수 엔티티 이름 = Nila 및 parentEntity = 500000001을 매개 변수로 설정하려고합니다.HTTP Get 요청을 사용하는 RESTClient
URL url = new URL("http://192.168.210.74:9763/services/testEntityService?entityName=Nila&parentEntity=500000001");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Accept", "application/json");
if (conn.getResponseCode() != 200) {
throw new RuntimeException("Failed : HTTP error code : "
+ conn.getResponseCode());
}
BufferedReader br = new BufferedReader(new InputStreamReader(
(conn.getInputStream())));
String output;
System.out.println("Output from Server .... \n");
while ((output = br.readLine()) != null) {
System.out.println(output);
}
conn.disconnect();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
글쎄, 문제는 서버 측에 있습니다 ... – fge
비즈니스의 첫 번째 주문 - 응용 프로그램/json을 수락하기 위해 연결하는 서비스가 있습니까? 나는 문제가 클라이언트 측이 아니라 서버 측에 있다고 제안 할 것이다. –