Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7879101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:49:39+00:00 2026-06-03T03:49:39+00:00

I have a java webservice, that must return a response if the login is

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T03:49:41+00:00Added an answer on June 3, 2026 at 3:49 am

    I should use the code

    stringEntity.setContentEncoding(HTTP.UTF_8);
    

    to set the encoding mode to UTF,
    with this, the server accept the json request and give the correct response

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created one application in flex that is accessing the Java webservice using
I have a webservice in java that receives a list of information to be
I have a JAX-RPC (Java) web service that needs to return a complex polymorphic
I have a Java RESTful webservice that will be called about every 10 seconds
I have jBoss running on Linux that runs a Java SOAP webservice. I normally
We have a legacy WSE3 ASP.Net webservice here that defines a method GetFileContent(string fileName)
I have written a small webservice[Axis2/Java] which exposes a method public String Fill(String cacheName
We have a java web service application that uses log4j to do logging. An
We have a dotnet web service that a java using customer wants to connect
I have a Java client that calls a web service at the moment using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.