I have a java webservice, that must return a response if the login is successful
The return line of the server side method is
return new Response(new InfoSessionJson(newKey, is), null, id);
To get the response I have tried to use the code
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());
But the output print returns an apache error
I have tried to print the output of the
HttpEntity entity = response.getEntity();
InputStream is = entity.getContent();
directly with
System.out.print(entity);
System.out.print(response);
and this print:
org.apache.http.conn.BasicManagedEntity@40575ac8 org.apache.http.message.BasicHttpResponse@40574a00
Where is the error??
I cannot parse the response correctly or the problem is before???
the webservice method has this fim
@Webservice(paramNames = {"email", "password", "stayLogged", "idClient"},
public Response startSession(String email, String password, Boolean stayLogged, String idClient)
and I send a json with
StringEntity stringEntity = new StringEntity(jsonObject.toString());
httpost.setEntity(stringEntity);
httpost.setHeader("Accept", "application/json");
httpost.setHeader("Content-type", "application/json");
Where the json object sent is
{"method":"startSession","params":[{"email":"test.web@yahoo.it","password":"1234","idClient":"ANDROID","stayLogged":"1"}]}
The webservice works fine with an iOS app but wont work with mine android app,
Where is the error in the procedure that I have described in this thread???
I hope someone can help me.