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 7985745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:38:41+00:00 2026-06-04T11:38:41+00:00

I call method in webservice that return string true or false and take two

  • 0

I call method in webservice that return string “true” or “false” and take two parameters using the following code

String isLogedin = readTwitterFeed();
public String readTwitterFeed() {

        String Result = null;

        StringBuilder URL = new StringBuilder();

        URL.append("http://localhost:1539/WCFService1/Service.svc/Login/");
        URL.append(username.getText());
        URL.append("/");
        URL.append(password.getText());

        ///////////////////////////// 
        HttpClient client = new DefaultHttpClient();
        HttpGet httpGet = new HttpGet(
                URL.toString());




        try {
            HttpResponse response = client.execute(httpGet);
            StatusLine statusLine = response.getStatusLine();
            int statusCode = statusLine.getStatusCode();
            if (statusCode == 200) {
                HttpEntity entity = response.getEntity();
                InputStream content = entity.getContent();
                BufferedReader reader = new BufferedReader(
                        new InputStreamReader(content));

                StringBuilder builder = null ;
                String line = null;
                while ((line = reader.readLine()) != null) {
                    builder.append(line);
                }

                Result = builder.toString() ;


            } else {
                 Result = "error";
            }
        } catch (ClientProtocolException e) {
             Result = "error";
            e.printStackTrace();
        } catch (IOException e) {
             Result = "error";
            e.printStackTrace();
        }
        return Result;
    }

but the returned string is always empty

any idea why it not return data, also it doesn’t display any error (I display the return value on textview), also I set the permission for internet like that

 <uses-permission android:name="android.permission.INTERNET"></uses-permission>

and am sure that the service is running

  • 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-04T11:38:42+00:00Added an answer on June 4, 2026 at 11:38 am

    Localhost and 127.0.0.1 are Android emulated device's own loopback interface,In other words, you connect to android emulated device (not to your computer) by using localhost or 127.0.0.1. if you’re trying to access your development machine use 10.0.2.2.

    one thing in your code you did not intialize your StringBuilder builder

    initialize it like StringBuilder builder = new StringBuilder();

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

Sidebar

Related Questions

I am receiving xml from a webservice call that contains a nil=true : <cacheEntry>
We have a legacy WSE3 ASP.Net webservice here that defines a method GetFileContent(string fileName)
I am using webservice to call method in businesslogics(one class written in vb).I am
I call addNotify() method in class that I posted here. The problem is, that
I wanted to call Test1() Method Within WaitAndCallFunc() Function. Code: typedef void (*func)(); void
Short and sweet version: Is there a single web service method that would return
Within a web form I have the following jQuery setup to call a method
I've got a simple .NET web service that is supposed to return a string
I have a webservice that calls a method that returns a generic list of
I have an ASP.NET webservice method that returns a generics list (List'<'Construct>) serialized as

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.