-3

I have no idea about how to call a web service from Android application . I also want to use trulia web service to get data from it .

So please help me.

2 Answers 2

2

I dont know what trulia is, If you want to use a SOAP webservice, you should use KSOAP2. Google it and you will find alot of tutorials how to use it.

There are alot of pepol explain it good.

Are KSOAP2 not for you? Check out HTTPClient for android. here is a good one for that http://lukencode.com/2010/04/27/calling-web-services-in-android-using-httpclient/

Now, google and u find ur answer! GL !

1
  • Ur welcome! If its solve ur problem, dont forget to mark it as answer! ;) Dec 7, 2011 at 10:49
0

You can use HttpClient to connect with the webservice/webpage/remote-data.

Here is a sample code using that you can connect webservice from Android application

try {
    HttpClient client = new DefaultHttpClient();
    HttpGet method = new HttpGet(Url);
    HttpResponse response = client.execute(method);
    StatusLine status = response.getStatusLine();
    if (status.getStatusCode() == HttpStatus.SC_OK) {
        ResponseHandler<String> responseHandler = new BasicResponseHandler();
        String responseBody = responseHandler.handleResponse(response);
        return responseBody;
    }
    return null;

} catch (Exception e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    return null;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.