我使用下面提到的方法调用Url并获得此响应
"对象引用未设置为对象的实例"
但是当我在POSTMAN中使用get方法调用此url时,我收到了响应
" OK"和"用户名无效"。
请您告诉我我做错了什么或者这个服务器错误了吗?
HttpClient httpClient = new DefaultHttpClient();
HttpResponse response = httpClient.execute(new HttpGet("http://www.myvirtualmd.net/Apps/Controller/securityController.aspx?type=RESET_PASSWORD&info=dsadas"));
HttpEntity entity = response.getEntity();
entity.getContentLength();
StringBuilder sb = new StringBuilder();
try {
BufferedReader reader =
new BufferedReader(new InputStreamReader(entity.getContent()));
String line = "";
while ((line = reader.readLine()) != null) {
sb.append(line);
}
}
catch (IOException e) { e.printStackTrace(); }
catch (Exception e) { e.printStackTrace(); }
System.out.println("finalResult " + sb.toString());
答案 0 :(得分:2)
可能有html标记响应Api,您可以通过Postman的RAW响应进行检查。