trainingtrains Logo

91-9990449935

 0120-4256464

Android Web Service Tutorial

Creating web service application in android is not a difficult task. We can easily create a restful web service application in android to authenticate or save information into the external database such as oracle, mysql, postgre sql, sql server using other application developed in java, .net, php etc languages. That is what we are going to do.

Android Restful Web Service Tutorial

Before developing web services application, you must have basic knowledge of SOAP and Restful web services. That is why, we are going to discuss basic points about web services such as what is web service and brief information about SOAP and Restful web services.

What is Web Service?

A web service is a standard for exchanging information between different types of applications irrespective of language and platform. For example, an android application can interact with java or .net application using web services.

Android Restful Web Service Example

File: activity_main.xml
File: activity_register_user.xml

MainActivity class

File: MainActivity.java

RegisterUser class

File: RegisterUser.java

File: AndroidManifest.xml

You need to provide INTERNET permission in AndroidManifest.xml file.



Output:

android web service example output 1 android web service example output 2

Java Servlet Login and Register example using oracle database

Create table trainingtrains_user in the oracle database having three columns id, name and password. Id must be primary key and generated through SEQUENCE.

New create two servlet classes to login and register user.

Login Servlet class

File: Login.java

httpPostServlet Servlet class

File: httpPostServlet.java

index.jsp