我有一个 java webservice,如果登录成功,它必须返回一个响应
服务器端方法的返回行是
return new Response(new InfoSessionJson(newKey, is), null, id);
为了得到响应,我尝试使用代码
HttpResponse response = mClient.execute(httppost);
HttpEntity entity = response.getEntity();
InputStream is = entity.getContent();
if(response != null){
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
StringBuilder sb = new StringBuilder();
String line = null;
loggato=true;
try {
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
}
System.out.println("The response is "+sb.toString());
但是输出打印返回一个 apache 错误
我试图打印的输出
HttpEntity entity = response.getEntity();
InputStream is = entity.getContent();
直接用
System.out.print(entity);
System.out.print(response);
这个打印:
org.apache.http.conn.BasicManagedEntity@40575ac8 org.apache.http.message.BasicHttpResponse@40574a00
错误在哪里??
我无法正确解析响应或问题出在前面???
webservice方法有这个fi
@Webservice(paramNames = {"email", "password", "stayLogged", "idClient"},
public Response startSession(String email, String password, Boolean stayLogged, String idClient)
我发送一个json
StringEntity stringEntity = new StringEntity(jsonObject.toString());
httpost.setEntity(stringEntity);
httpost.setHeader("Accept", "application/json");
httpost.setHeader("Content-type", "application/json");
发送的json对象在哪里
{"method":"startSession","params":[{"email":"test.web@yahoo.it","password":"1234","idClient":"ANDROID","stayLogged":"1"}]}
该网络服务适用于 iOS 应用程序,但不适用于我的 android 应用程序,
我在这个线程中描述的过程中的错误在哪里???
我希望有一个人可以帮助我。