Saurabh Agrawal
Saurabh Agrawal

Reputation: 1365

How to perform client-server communication with android app? Can I use servlet on server side or do I need to implement web service?

I am developing an android app where a user has to enter his login details for authentication...the app will then check username and password entered by user on server and will act accordingly..so how to pass these login details to server..and do I need to implement web service on server side or can use servlet?

Can anyone please tell me which Web Service should I use for the above purpose...also I need to send other data from my client app to server, process it on server and give back the reply to client app...also how to implement a web service? Are there any tools for it? Any tutorials would be of great help. Thanks in advance...

Upvotes: 0

Views: 1269

Answers (2)

kosa
kosa

Reputation: 66637

You can use servlet (or) webservice, any service, as long as it can be accessed through URL. Make sure the servlet/webservice returning XML/JSON (one of these two formats are preferred, you need to code your servlet/service to return response in one of these formats) response when you hit the URL in internet explore. Once you make sure URL is returning data, then

1) In your app, using HTTPClient, invoke the URL
2) You will get either XML/JSON
3) If it JSON, use in buit JSONObject to parse the response and get the data
   If response is XML, use either SAX/Dom parsing to parse the response.

Upvotes: 0

a fair player
a fair player

Reputation: 11776

well, to send data to the server you can use HttpPost and HttpGet requests. and as you need to get results from the server then, yes you'll need a web service.

Upvotes: 1

Related Questions