我有一个java web服务,如果登录成功,必须返回响应无法打印JSON-RPC响应
服务器端方法的返回线
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);
这种打印:
[email protected] org.apache .http.message.BasicHttpResponse @ 40574a00
错误在哪里?
我无法正确解析响应或问题出现在?
WebService的方法有这个FIM
@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":"[email protected]","password":"1234","idClient":"ANDROID","stayLogged":"1"}]}
的web服务工作正常使用iOS应用程序,但不会与我的Android应用程序,
我在此线程中描述的过程中的错误在哪里?
我希望有人能帮助我。
谢谢你,我已经纠正这一错误并打印一些东西......但错误,而不是正确的响应与会话密钥,我不明白为什么 – AndreaF 2012-03-03 18:00:00