In this article, we discus about easiest web to access web service in android. First of all I will tell you how to create web service(SQL database)  in Visual Studio with in 5 steps

Step 1: File—>web Site(click)  —>ASP .Net web Service

Access C# .net Web service in Android(simple one for Beginners)

Step 2 : Create a Table: If Server Explorer is not appear ,then press ctrl + alt + s.Then add your data connection according to your database. Then add new table to your database.



   Input some sample data as following

Step 3 : add a new class call ConnectionManager


Double Click Your connectionManager.Class class @ solution Explore .Then type this code using System;

Iin here you have to change your  ConStr according to your database connection

Step 4 : add a new web method

Double click Service.cs –>Then type  following code(copy & paste)using System;

Step 5 : Run your web service

Now you can see your findContact( ) WEB METHOD will appear on webs service
Now we can check this web service is work correctly, there for click findContact(light blue color) on web service.

type student no according to your insert data to the table.

now this web service is work properly. according to the student no it will appear student name.

Now I will tell you how to access this web service in Android

Step 1 : create your android project and create this main XML file

Step 2 : Download ( KSOAP from the internet and locate on your hard disk.And add to the to your Android Project
Step 3 :Then Type following code in main activity .java class (according to your Main Activity class(.java) )which class you decide to display data.
Step 4 : Add User Permission to Manifest
Step 5 : Run your App

Access web service in android | web service tutorial | access web service in android | android web service in android

Leave a Comment