0

I have the following site http://www.freewebservicesx.com/GoldSpotPrice.aspx which provides a webservice api. As i am extremely new to soap and rest i have absolutely no clue about how to call this service and use it in android. Could someone please tell me how to do it.

2 Answers 2

1

You can make HTTP requests using either HttpURLConnection or HttpClient. Example of using HttpClient for a RESTful web service:

HttpClient httpClient = new DefaultHttpClient();
HttpGet httpGet = new HttpGet("http://www.mywebsite.com/webservice");
HttpResponse response = httpClient.execute(httpGet);
StatusLine statusLine = response.getStatusLine();
if (statusLine.getStatusCode() == HttpStatus.SC_OK) {
    HttpEntity entity = response.getEntity();
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    entity.writeTo(out);
    out.close();
    String responseStr = out.toString();
    // process response
} else {
    // handle bad response
}

Otherwise, if you're working with a SOAP web service, I would recommend using ksoap2

Sign up to request clarification or add additional context in comments.

1 Comment

freewebservicesx.com/GetGoldPrice.asmx?op=GetCurrentGoldPrice is the file. How would i go about calling this with username and password
1

Use the following url to refer:::

Using ksoap2 for android, and parsing output data...

ksoap2-android - HowToUse.wiki.....

ksoap2-android

Use this LINK it has a sample the suits your requirement.

also LINK

1 Comment

freewebservicesx.com/GetGoldPrice.asmx?op=GetCurrentGoldPrice is the file. How would i go about calling this from android

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.