waseemwk
waseemwk

Reputation: 1509

Calling Java RESTful webservice in Android

i have created a Java Restful Web service. Now i want to access it in Android. There are different methods in Webservice. Web service is running on http://192.15.10.62:8080. how should i call a method named getGreetingMsg() in webservice which take a string argument and return a simple String message.

Web service Details

Project name RestFulWS

package Name rest.ws.server

class Name helloAndroid

Method Name getGreetingMsg(string argument)

any help will be appreciated.

Upvotes: 0

Views: 3018

Answers (3)

Mukesh Kumar
Mukesh Kumar

Reputation: 661

It depend on the Web server you are using because each type of server will have its own URL to service hosted on it. If you are using JBOSS server then your URL looks like this IP:PORT/projectname/webservicename/method name

Upvotes: 1

Sly
Sly

Reputation: 2101

Simply with an HTTP client like AndroidHttpClient.

EDIT: RESTful web service is accessible through URL like:

http://yourserver/someservice/<categoryID>/<objectID>

So, you can test your webservice from a web browser like Internet Explorer or Mozilla Firefox.

Then, on Android, use HTTP Get request and the AndroidHttpClient.

Don't forget to set the INTERNET permission in your AndroidManifest.xml too

Upvotes: 5

dbDev
dbDev

Reputation: 1549

Sounds like you're not sure how to approach your own API. If your API supports GET, then open a web browser and try some GET commands. Once you have a GET statement working, work through this tutorial: http://sarangasl.blogspot.com/2011/06/android-login-screen-using-httpclient.html.

Once you're set with POST, turn off GET in your webserver.

Good luck!

db

Upvotes: 1

Related Questions