Saturday, May 26, 2012

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

  •  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     

  



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.











create your table


Save your table with table name


   enter some sample data



Step 3 : add a new class call connectionManager
 




give a class name :- ConnectionManager.Class



click "Yes" button
Double Click Your connectionManager.Class class @ solution Explore .Then type this code

//----------------------------------------
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;


public class ConnectionManager
{
  


    public static SqlConnection NewCon;
    public static string ConStr = 

"Data Source=ADRIAN-PC\\SQLEXPRESS;Initial Catalog=SimpleLife;Integrated Security=True";

    public static SqlConnection GetConnection()
    {
        NewCon = new SqlConnection(ConStr);
        return NewCon;
    }

}

//------------------------------------------------------------------------

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






Step 4 : add a new web method


                                                                Double click Service.cs
Double click Service.cs -->Then type  following code(copy & paste)

//----------------------------------------------------
using System;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Data;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

public class Service : System.Web.Services.WebService
{
    public Service () {

       
    }

    [WebMethod]
    public string findContact(string eid) {

       return getContact(eid);
    }


    public String getContact(String eid)
    {

        SqlConnection conn;
        conn = ConnectionManager.GetConnection();
        conn.Open();
     
        SqlCommand newCmd = conn.CreateCommand();
     
        newCmd.CommandType = CommandType.Text;
        newCmd.CommandText = "select Name from dbo.StudentContact where studentNo='" + eid + "'";
        SqlDataReader sdr = newCmd.ExecuteReader();
        String address=null;
        if (sdr.Read())
        {
            address = sdr.GetValue(0).ToString();
        }
   
        conn.Close();
        return address;
       

    }

}
//------------------------------------------------------

Step 5 : Run your web service


This 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

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <EditText
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="Type Student no"
    android:id="@+id/editText1">                          
    </EditText>
   
    <Button
    android:text="Get Name"
    android:id="@+id/button1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">
    </Button>
   
    <TextView
    android:text="from Web service"
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">
    </TextView>
   
</LinearLayout>

Step 2 : Download (http://sourceforge.net/projects/ksoap2/) 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.


package com.webservice;             //In Here Your
package com."    your one     ";
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;



import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class Main extends Activity
{
    /** Called when the activity is first created. */
    private static final String SOAP_ACTION = "http://tempuri.org/findContact";
   
    private static final String OPERATION_NAME = "findContact";// your webservice web method name
   
    private static final String WSDL_TARGET_NAMESPACE = "http://tempuri.org/";
   
    private static final String SOAP_ADDRESS = "http://10.0.2.2:1506/WebSite3/Service.asmx";
// for the SOAP_ADDRESS, run your web service & see 
//your web service Url :1506/WebSite3/Service.asmx ,1052 will be change according to your PC

    TextView tvData1;
    EditText edata;
    Button button;
    String studentNo;
//http://localhost:1827/WebSite1/Service.asmx/HelloWorld
  
    //http://10.0.2.2:1827/WebSite1/Service.asmx
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
       
        tvData1 = (TextView)findViewById(R.id.textView1);
      
       
        button=(Button)findViewById(R.id.button1);
       
        button.setOnClickListener(new OnClickListener() {
           
            public void onClick(View v) {
                  SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE,     OPERATION_NAME);
                    PropertyInfo propertyInfo = new PropertyInfo();
                    propertyInfo.type = PropertyInfo.STRING_CLASS;
                    propertyInfo.name = "eid";
                   
                    edata =(EditText)findViewById(R.id.editText1);
                    studentNo=edata.getText().toString();
                   
                    request.addProperty(propertyInfo, studentNo);
                           
                            SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
                            SoapEnvelope.VER11);
                            envelope.dotNet = true;
                           
                            envelope.setOutputSoapObject(request);
                           
                            HttpTransportSE httpTransport = new HttpTransportSE(SOAP_ADDRESS);
                           
                            try  {                   
                            httpTransport.call(SOAP_ACTION, envelope);                   
                            Object response = envelope.getResponse();                   
                            tvData1.setText(response.toString());                   
                            }  catch (Exception exception)   {
                                          tvData1.setText(exception.toString()+"  Or enter number is not Available!");                   
                            }
                   
                    tvData1 = (TextView)findViewById(R.id.textView1);
               
            }
        });
       
                 
        //client = new DefaultHttpClient();           
        //new Read().execute("text");
 }
}

Step 4 : Add User Permission to Manifest
   
          " Internet User Permission "

Step 5 : Run your App

type Student No then click the button
 




Good Luck!











352 comments:

  1. I have downloaded the ksoap2 file from the link you have provided but it does not contain a jar file......So that it give me a class not found exception when i run the app.....
    " java.lang.NoClassDefFoundError: org.ksoap2.serialization.SoapObject"

    ReplyDelete
    Replies
    1. sorry Bro....
      Try this link....

      http://www.4shared.com/file/uOhx5aoj/ksoap2-android-assembly-24-jar.html

      if this one is not working ......PLZ send your Email address ...
      my email address : dhanushkaadrian12@gmail.com
      I will send ksoap2.jar
      good luck!

      Delete
    2. hi guys....can u help...

      I am trying to develop ASP.NET web application and also Android UI for the same application. I am new to android. I developed a simple screen that has a 2buttons and texview. Type something and clicking the button, saves theBooking datas in the dot.net database.and another one is clicking the button view Booking details...

      Delete
  2. Hey can you tell me how you got the SOAP address as?
    private static final String SOAP_ADDRESS = "http://10.0.2.2:1506/WebSite3/Service.asmx"

    When I run the web service the URL is:
    http://localhost:64987/WebSite1/Service.asmx

    How did you get http://10.0.2.2:1506/WebSite3/Service.asmx??

    ReplyDelete
    Replies
    1. hey brother sorry for the late comment...(due to the exam)
      consider about your Url
      http://localhost:64987/WebSite1/Service.asmx

      we have to add 10.0.2.2 to your Url
      because we have to access Local host from the Android Emulator..

      now you have to change your Url like this
      http://10.0.2.2:64987/WebSite1/Service.asmx

      for more details check this blogs:-
      http://saigeethamn.blogspot.com/2011/11/localhost-access-in-android-emulator.html

      good Luck!

      Delete
    2. its by default url to run webservice locally on your computer bro!!!used it http://10.0.2.2:64987/WebSite1/Service.asmx

      Delete
    3. I have used 10.0.2.2 with the tailing port number 58497 of my pc. But getting java.net.ConnectException: failed to connect to /127.0.0.1 (port 58497): connect failed: ECONNREFUSED (Connection refused) error. What's wrong with my URL? Any help..pls..

      Delete
  3. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. am gettting error like this
      java.lang.NoClassDefFoundError: org.ksoap2.serialization.SoapObject
      in android
      what i have to do
      pls answer me

      Delete
  4. Hi thanks for the tutorial it was a grate help , I am trying to receive multiple Strings from the web service any way to do that , thanks again.

    ReplyDelete
    Replies
    1. Change your sql statement like this

      public String getReason1(string s)
      {
      conn.Open();
      SqlCommand newCmd = conn.CreateCommand();
      //newCmd.Connection = conn;
      newCmd.CommandType = CommandType.Text;
      newCmd.CommandText = "BookTitle from dbo.Book where BookCategory='" + s + "'";
      SqlDataReader sdr = newCmd.ExecuteReader();
      String myData = null;
      while (sdr.Read())
      {
      myData = myData + sdr["BookTitle"] + " , ";


      }
      conn.Close();
      return myData;

      }
      // in here you can take all book title in table with “,” …
      // like this:- science,Biology,History,
      //then you can split this book title and take it in to Array in android

      String str2array;// put web service values in to this string ,

      String[] arr=str2array.split(","); // in android

      Delete
  5. how to retrieve multiple value from a .net web service using soap.......and then howto display that data value in spinner ...is it possibe? any one help me....thanks in advance

    ReplyDelete
    Replies
    1. Change your sql statement like this

      public String getReason1(string s)
      {
      conn.Open();
      SqlCommand newCmd = conn.CreateCommand();
      //newCmd.Connection = conn;
      newCmd.CommandType = CommandType.Text;
      newCmd.CommandText = "BookTitle from dbo.Book where BookCategory='" + s + "'";
      SqlDataReader sdr = newCmd.ExecuteReader();
      String myData = null;
      while (sdr.Read())
      {
      myData = myData + sdr["BookTitle"] + " , ";


      }
      conn.Close();
      return myData;

      }
      // in here you can take all book title in table with “,” …
      // like this:- science,Biology,History,
      //then you can split this book title and take it in to Array in android

      String str2array;// put web service values in to this string ,

      String[] arr=str2array.split(","); // in android

      //By using this array you can add this items to list view or ....

      Delete
  6. can you please..put a Web Service REST Tutorial...please!!

    ReplyDelete
  7. The method addProperty(PropertyInfo, Object) from the type SoapObject is deprecated

    warning on line request.addProperty(...)

    ReplyDelete
  8. I am getting the error.
    the name ' connection manager ' does not exist in the current context
    how to resolve this problem.

    ReplyDelete
  9. now I am getting the error.
    Cannot open database "logindb" requested by the login. The login failed.
    Login failed for user 'CISLIVE3\dilwar'.

    ReplyDelete
  10. anybody know how to solve this error.
    java.lang.NullPointerException
    please help me as soon as possible

    ReplyDelete
    Replies
    1. did u fix that error
      i'm also having the same problem

      Delete
    2. you should use asynctask for network operation
      And by the way you wil get many other exceptions like networkOnMainThread..

      Delete
  11. I've tried your coding but when I tried of Android apps can not display data from its web? diandroid applications directly out

    ReplyDelete
    Replies
    1. have you added android internet permission??

      Delete
  12. Hi:),I'm getting this error
    "android java.net.sockettimeoutexception to connect to 10.0.2.2:55980/LocalSite/Service.asmx"..is there anything I can do,oh and btw great tutorial:)

    ReplyDelete
  13. I forgat to say that this only happens when testing on my device.In emulator it works

    ReplyDelete
  14. I am getting an error when i am entering the StudentNo... the error is "UNFORUNATLY THE APP IS STOP".

    please can anyone help me out

    ReplyDelete
  15. how it would be with two parameters

    ReplyDelete
    Replies
    1. Change your sql statement like this

      public String getReason1(string s)
      {
      conn.Open();
      SqlCommand newCmd = conn.CreateCommand();
      //newCmd.Connection = conn;
      newCmd.CommandType = CommandType.Text;
      newCmd.CommandText = "BookTitle from dbo.Book where BookCategory='" + s + "'";
      SqlDataReader sdr = newCmd.ExecuteReader();
      String myData = null;
      while (sdr.Read())
      {
      myData = myData + sdr["BookTitle"] + " , ";


      }
      conn.Close();
      return myData;

      }
      // in here you can take all book title in table with “,” …
      // like this:- science,Biology,History,
      //then you can split this book title and take it in to Array in android

      String str2array;// put web service values in to this string ,

      String[] arr=str2array.split(","); // in android

      Delete
  16. i am getting error in android while running
    error :no class deffounderror:org.koasp2.serialization.soapobject at com.example.network.mainactivity$1.onClick(MainAtivity.java:41)

    ReplyDelete
  17. I am getting an error of not getting connected to server or instance does
    not appear. Help me out

    ReplyDelete
  18. how can I publish apk with jar file to actual device ?

    ReplyDelete
  19. This blog offers the c#.Net services in mobile applications..
    C#.Net Training in Noida

    ReplyDelete
  20. I was very pleased to find this site. I wanted to thank you for this great read!! I definitely enjoyed every little bit of it and I have you bookmarked to check out the new stuff you post. cell phone detector

    ReplyDelete
  21. Excellent information, Great post here. I found that you shared a complete information on Android Apps Development. OnGraph Technologies provide Android App development services and other Mobile app development services.

    ReplyDelete
  22. Dude I usually do not comment on posts, but this one is fucking good, thank you, after 2 days and 2 nights looking for something about how to consume the web service .net from android, I found this post which solved my problems in 20 minutes! thank you very much!

    ReplyDelete
  23. Hai,
    First of all thank you so much for the post.
    I have faced one error while programming the error is like this.
    android.Os.NetworkOnMainThreadException
    am not able to trace it can anybody help me??

    ReplyDelete
    Replies
    1. you should use asynctask for network operation.

      Delete
    2. how do you use asynctask it?

      Delete
  24. First of ALL Thank u so much for u
    im getting error like java.lang.null pointer exception
    could u please resolve this
    please help

    ReplyDelete
    Replies
    1. hey palani......
      call the web service from async task....
      your problm will be solved.....
      if not let me know......
      happy coding :)

      Delete
    2. can you write the code for async task please

      Delete
  25. Hello sir,I did whole code as it is .I did .net web service.But still i am facing problem with accessing data in android .
    On click of button following error is occurred ....

    06-26 05:59:35.346: E/AndroidRuntime(3958): FATAL EXCEPTION: main
    06-26 05:59:35.346: E/AndroidRuntime(3958): Process: com.example.ksoap, PID: 3958
    06-26 05:59:35.346: E/AndroidRuntime(3958): java.lang.NoClassDefFoundError: org.ksoap2.serialization.SoapObject
    06-26 05:59:35.346: E/AndroidRuntime(3958): at com.example.ksoap.MainActivity$1.onClick(MainActivity.java:53)
    06-26 05:59:35.346: E/AndroidRuntime(3958): at android.view.View.performClick(View.java:4424)
    06-26 05:59:35.346: E/AndroidRuntime(3958): at android.view.View$PerformClick.run(View.java:18383)
    06-26 05:59:35.346: E/AndroidRuntime(3958): at android.os.Handler.handleCallback(Handler.java:733)
    06-26 05:59:35.346: E/AndroidRuntime(3958): at android.os.Handler.dispatchMessage(Handler.java:95)
    06-26 05:59:35.346: E/AndroidRuntime(3958): at android.os.Looper.loop(Looper.java:137)
    06-26 05:59:35.346: E/AndroidRuntime(3958): at android.app.ActivityThread.main(ActivityThread.java:4998)
    06-26 05:59:35.346: E/AndroidRuntime(3958): at java.lang.reflect.Method.invokeNative(Native Method)
    06-26 05:59:35.346: E/AndroidRuntime(3958): at java.lang.reflect.Method.invoke(Method.java:515)
    06-26 05:59:35.346: E/AndroidRuntime(3958): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
    06-26 05:59:35.346: E/AndroidRuntime(3958): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
    06-26 05:59:35.346: E/AndroidRuntime(3958): at dalvik.system.NativeStart.main(Native Method)

    please help me solve this problem .

    ReplyDelete
  26. can pls anyone tell me how to change this ConStr

    public static string ConStr =
    "Data Source=ADRIAN-PC\\SQLEXPRESS;Initial Catalog=SimpleLife;Integrated Security=True";

    ReplyDelete
  27. Nice post!!!!!!!!
    It provides the training in DOT NET and PHP...
    6 Months Training in C#.Net

    ReplyDelete
  28. Mobile App Development services and Android Application development is custom Mobile application development and Android Application Development Company, who offers hire an affordable, professional and skilled mobile app developers.

    ReplyDelete
  29. This comment has been removed by the author.

    ReplyDelete
  30. android.os.NetworkOnMainThreadException on execute

    ReplyDelete
  31. i dont see "add new table" (2. process)

    ReplyDelete
  32. How can i Insert into the webservice database from android

    ReplyDelete
  33. i need help...i created web service (wcf, json return, framework 4.0) on visual studio 2012 and publish it in iis and run it on url (ip address)...in browser, but when i call it on android mobile then nothing return...

    ReplyDelete
    Replies
    1. how would done json in asp.net webservice?

      Delete
  34. mobile application development cost in india -
    Innverse Technologies India Bassed Mobile Application Development Company offer Mobile Game development, Android Application Development and iPhone Application Development services according your needs and budget

    ReplyDelete
  35. It’s nice information regarding mobile application development. The new mobile apps updations can clears first before develop any mobile app.

    ReplyDelete
  36. The app crashes every time while i use the "GET Name" button....am i missing smthng ??....

    ReplyDelete
  37. if need the code for login can u send to me by mail or publish online my mail is :: ibrahim.miari26@gmail.com

    ReplyDelete
  38. Wonderful blog & good post.Its really helpful for me, awaiting for more new post. Keep Blogging!

    Mobile Application Development Training in Chennai

    ReplyDelete
  39. getting Exception

    org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG@2:7 in java.io.InputStreamReader@1956e49a)

    facing problem with httpTransport.call(SOAP_ACTION, envelope); could u please resolve this

    ReplyDelete
  40. I am getting networkonmainthreadexception .plz give me solution

    ReplyDelete
  41. hi...i did same code ..but i have an error like ths"Unfortunaly ur app force to close"

    ReplyDelete
  42. hi...my webserviices s workng fine ...pls check these url ..pls help me..:-(


    /** Called when the activity is first created. */
    private static final String SOAP_ACTION = "http://tempuri.org/GetVehicleDetails";

    private static final String OPERATION_NAME = "GetVehicleDetails";// your webservice web method name

    private static final String WSDL_TARGET_NAMESPACE = "http://tempuri.org/";

    private static final String SOAP_ADDRESS = "http://10.0.2.2:64987/WebSite1/Service.asmx/GetVehicleDetails";

    ReplyDelete
  43. Good example but..
    can you please provide example using Async Task

    ReplyDelete
  44. Please help.
    java.lang.IllegalArgumentException: is == null, below are my logcat messages.

    10-15 17:22:30.865 27119-27134/com.example.admin.sqlservice W/System.err: java.lang.IllegalArgumentException: is == null
    10-15 17:22:30.865 27119-27134/com.example.admin.sqlservice W/System.err: at org.kxml2.io.KXmlParser.setInput(KXmlParser.java:1625)
    10-15 17:22:30.865 27119-27134/com.example.admin.sqlservice W/System.err: at org.ksoap2.transport.Transport.parseResponse(Transport.java:117)
    10-15 17:22:30.869 27119-27134/com.example.admin.sqlservice W/System.err: at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:275)
    10-15 17:22:30.869 27119-27134/com.example.admin.sqlservice W/System.err: at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:118)
    10-15 17:22:30.869 27119-27134/com.example.admin.sqlservice W/System.err: at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:113)
    10-15 17:22:30.869 27119-27134/com.example.admin.sqlservice W/System.err: at com.example.admin.sqlservice.MainActivity$MyTask.doInBackground(MainActivity.java:84)
    10-15 17:22:30.869 27119-27134/com.example.admin.sqlservice W/System.err: at com.example.admin.sqlservice.MainActivity$MyTask.doInBackground(MainActivity.java:63)
    10-15 17:22:30.873 27119-27134/com.example.admin.sqlservice W/System.err: at android.os.AsyncTask$2.call(AsyncTask.java:288)
    10-15 17:22:30.873 27119-27134/com.example.admin.sqlservice W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    10-15 17:22:30.873 27119-27134/com.example.admin.sqlservice W/System.err: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
    10-15 17:22:30.877 27119-27134/com.example.admin.sqlservice W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
    10-15 17:22:30.877 27119-27134/com.example.admin.sqlservice W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
    10-15 17:22:30.877 27119-27134/com.example.admin.sqlservice W/System.err: at java.lang.Thread.run(Thread.java:841)

    ReplyDelete
  45. This comment has been removed by the author.

    ReplyDelete
  46. This post is really nice and informative. The explanation given is really comprehensive and informative.Best Web Design Company in Bangalore | Website Development Company Bangalore

    ReplyDelete
  47. C# or .net is today's growing programming languages. Web and Apps Development Services Jaipur. Jovi International provides the best Web and Apps Development, E Commerce Web Development, Custom Web Application Services in Jaipur and all over India.

    ReplyDelete
  48. Accuratesolutionltd führt mobile app Entwicklungsunternehmen. Wir entwickeln Apps für Handys, Tablets , iPads und iPhones . Dies ist aufgrund der zunehmenden Nutzung von Internet und Mobilgeräte in Deutschland .

    ReplyDelete
  49. Durchsuchen e-Commerce professionelle Web und Application Development Company bietet eine erschwingliche E-Commerce- Entwicklung, Magento Commerce-Entwicklung .http://www.accuratesolutionsltd.com/e-commerce-entwicklung/

    ReplyDelete
  50. I found the error : java.lang.illegalargumentexception.
    Please help me to resolve.

    ReplyDelete
  51. hello,sir
    how to solve error:java.net.Stacktimeout exception.
    please reply

    ReplyDelete
    Replies
    1. You can do with AsyncCallWS task method.

      button1.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
      id=edata.getText().toString();
      AsyncCallWS task = new AsyncCallWS();
      task.execute();

      }
      });
      private class AsyncCallWS extends AsyncTask {

      @Override
      protected String doInBackground(String... params) {
      request = new SoapObject(NAMESPACE, "findContact");
      eid=new PropertyInfo();
      eid.setName("eid");
      eid.setValue(id);
      eid.setType(String.class);
      request.addProperty(eid);
      envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
      // creating a serialized envelope which will be used to carry the
      // parameters for SOAP body and call the method
      envelope.dotNet = true;
      envelope.setOutputSoapObject(request);
      androidHttpTransport = new HttpTransportSE(URL);
      try {
      androidHttpTransport.call(SOAP_ACTION + "findContact", envelope); // Hello

      //SoapPrimitive response = (SoapPrimitive) envelope.getResponse();
      //Assign it to fahren static variable


      Log.d("1", "~");
      response = (SoapPrimitive) envelope.getResponse();
      //SoapObject response = (SoapObject)envelope.getResponse();
      //Log.d(,"~");
      serverreponse = response.toString();

      } catch (Exception e) {
      e.printStackTrace();
      serverreponse = "Error Occurred";
      }
      return serverreponse;
      }
      protected void onPostExecute(String result) {

      tvData1.setText(result);
      Intent myIntent = new Intent(FindActivity.this,FinalActivity.class);
      myIntent.putExtra("mytext",result);
      startActivity(myIntent);
      }

      Delete
    2. What you mean by "//SoapPrimitive response = (SoapPrimitive) envelope.getResponse();
      //Assign it to fahren static variable"

      Delete
  52. I am getting error in line " request.addProperty(propertyInfo, studentNo);" as "The method add property from the type soapobject is deprecated" Please help what to do how to resolve this ?

    ReplyDelete

  53. Dean Infotech Expert in Asp.Net Development Company India 260+ ASP.NET/VB.NET/C# Developers, Offshore Outsourcing, 15 Yrs Exp.

    ReplyDelete
  54. Hi nice job this was useful and informative regarding

    Dot Net Training

    Android Training

    ReplyDelete
  55. Nice post, I bookmark your blog because I found very good information on your blog, Thanks for sharing more information Android App Development Company in India

    ReplyDelete
  56. please send me asp.net webservice example
    ashishkevadiya003@gmail.com

    ReplyDelete
  57. Thanks for sharing as it is an excellent post. Pls visit us : Mobile App Design Chennai

    ReplyDelete
  58. Your post is very good and informative. Really your information also good. Keep more sharing valuable info with us. Web Designing Bangalore | Web Design Companies Bangalore

    ReplyDelete
  59. Error: error: class Main is public, should be declared in a file named Main.java


    This is the error am getting, Copied above given code...

    ReplyDelete
  60. Hello
    i am using this code in android studio but it didnt show any record when i am entering no. and i have published that webservice on IIS server.please help me

    ReplyDelete
  61. This comment has been removed by the author.

    ReplyDelete

  62. Your blog has given me that thing which I never expect to get from all over the websites. Nice post guys!
    regards,
    melbourne web designer

    ReplyDelete
  63. Awesome blog with valuable information. Keep sharing. very good resource for developers.
    PHP company in india

    ReplyDelete
  64. This is fine blog to learn application build process

    ReplyDelete
  65. A very awesome blog post. We are really grateful for your blog post. You will find a lot of approaches after visiting your post. I was exactly searching for. Thanks for such post and please keep it up. Great
    Android Application Development

    ReplyDelete
  66. Very amazing tutorial sir

    please urgently
    am still having an error after clicking the button when it try to retrieve the data which says the following:

    "org.xmlpull.v1.xmlpullparserexception:expected:START_TAG {http://schemas.xmlsoap.org/soap/envelop/}Envelope(position START_TAG @2.7 in java.io.inputStreamReader"

    Thanks in advance sir.

    ReplyDelete
  67. Nice post.Give it up. Thanks for share this article. For more detail visit Android App Development Company in India

    ReplyDelete
  68. Facing this problem and i am unable to resolve it

    org.xmlpull.v1.XmlPullParserException: expected: START_TAG

    ReplyDelete
  69. cannot resolve ksoap2 after putting ksoap2 in in project libs folder in android studio....pls give solution anyone

    ReplyDelete
  70. I am getting an exception NetworkonMainThread. Web Design Bangalore

    ReplyDelete
  71. It's interesting that many of the bloggers your tips helped to clarify a few things for me as well as giving..
    Mobile App Development Company
    Android app Development Company
    ios app development Company
    Mobile App Development Companies

    ReplyDelete
  72. Mobile Application design & development is a broad term that encompasses a wide variety of tasks.
    Magento Website Development Companies in Bangalore | Magento Development Service in Bangalore

    ReplyDelete
  73. Mobile Application design & development is a broad term that encompasses a wide variety of tasks.
    Magento Website Development Companies in Bangalore | Magento Development Service in Bangalore

    ReplyDelete
  74. how to make propertyinfo with 2 parameters?

    ReplyDelete
  75. Thanks for sharing such wonderful information about Asp.net Application Company.I read your articles very excellent and the i agree our all points because all is very good information provided this through in the post.

    ReplyDelete
  76. I was Rewriting a Research Paper-Dissertation Qualitatively before I landed on this coding forum and I have found important programming information that will help me to write my research program. Thanks so much for posting this information and I am looking forward to reading more interesting and educative threads from this forum.

    ReplyDelete
  77. Great explanation with coding and screenshots.
    thanks for sharing, it was very helpful for me.
    Web Design company in Hubli | web designing in Hubli | SEO company in Hubli

    ReplyDelete
  78. If you could explain something about the topic, it will be good for readers
    Web Design company in Hubli | web designing in Hubli | SEO company in Hubli

    ReplyDelete
  79. This comment has been removed by the author.

    ReplyDelete
  80. These ways are very simple and very much useful, as a beginner level these helped me a lot thanks fore sharing these kinds of useful and knowledgeable information.
    Mobile App Development Company
    Mobile App Development Companies

    ReplyDelete
  81. well post Vendorzapp provides Mobile apps for small business, Ecommerce android apps India, iOS ecommerce apps, Ecommerce website Pune, Ready ecommerce website and apps. Android ecommerce apps then visit now Ecommerce android apps India, iOS ecommerce apps, ecommerce website for small business call us +91-9850889625

    ReplyDelete

  82. Given so much info in it, These type of articles keeps the users interest in the website, and keep on sharing more ... good luck. Android Training in chennai |Android Training in Velachery

    ReplyDelete
  83. Thanks for sharing this imformative blog..... Click To Call services provider in India enable the business to enhance leads through the website visitors. Through this service, you can interact with the right customer service agent and website visitors, instantly and serve as an efficient customer service provider.

    ReplyDelete
  84. great blog Vendorzapp provides Mobile apps for small business, Ecommerce android apps India, iOS ecommerce apps, Ecommerce website Pune, Ready ecommerce website and apps. Android ecommerce apps then visit now Ecommerce android apps India, iOS ecommerce apps, ecommerce website for small business call us +91-9850889625

    ReplyDelete
  85. These ways are very simple and very much useful, as a beginner level these helped me a lot thanks fore sharing these kinds of useful and knowledgeable information.
    PHP training in chennai

    ReplyDelete
  86. Thanks for Sharing
    LeadNXT, the best Cloud Telephony Service provider offersClick to Call Services Provider In India Call service that enables businesses to enhance leads by converting your website visitors into sales leads.

    ReplyDelete
  87. LeadNXT, provides click to call services in India that allows website visitors to talk to appropriate customer service agents, instantly and generate business. Click To Call It allows to specific service agents instantly, and enable to generate business leads & improving sales conversions.

    ReplyDelete
  88. Thanks for sharing your fabulous idea. This blog is really very useful.Android App Development Company in India

    ReplyDelete
  89. sir...am getting error is like android.os.NetworkMainThreadExceptionError

    ReplyDelete
  90. When you are preparing to develop web applications you should ensure that you are familiar with the web service. This is because for every application, you need to host it in the right way so that it functions well. After reading this blog I have realized that there are new and convenient web services. As I read the Guidance on how to Write an Essay for android applications, I will use these tips.

    ReplyDelete

  91. Being new to the blogging world I feel like there is still so much to learn. Your tips helped to clarify a few things for me as well
    iOS App Development Company
    iOS App Development Company

    ReplyDelete
  92. Many thanks for making the effort to discuss this, I feel strongly about this and love studying a great deal more on this subject. If possible, as you gain knowledge, would you mind updating your webpage with a great deal more info? It’s very helpful for me.
    Regards
    Ella
    it service company
    it services company
    mobility software development

    ReplyDelete
  93. Being new to the blogging world I feel like there is still so much to learn. Your tips helped to clarify a few things for me as well
    iOS App Development Company

    ReplyDelete
  94. Nice article. Keep writing! e-commerce website development
    offers e-commerce website design and development in Chennai

    ReplyDelete
  95. Thanks for Sharing this great article..Its really nice and useful for us… keep sharing..
    Yasir Jamal

    ReplyDelete
  96. Thanks you very much for sharing. You always try to sharing such a good information with us.
    Android App Development Company in Delhi India

    ReplyDelete
  97. java.net time out exception in coming plz help

    ReplyDelete
  98. Nice post. Thanks for sharing and providing relevant information. This is really useful.
    Android App Development in Lucknow | Mobile App Development in Lucknow

    ReplyDelete
  99. Your blog is an interesting for reading. Thank you for Sharing.Mobile App development companies

    ReplyDelete
  100. Thank you for sharing information...you need an Software Development Company In Lucknow that will help you to increase

    your effective online presence, conversion rate, and automatically proffer you higher ROI. Contact Seo services Lucknow provide Digital Marketing company in Lucknow at affordable rate.
    Seo services Lucknow | Software Development Company In Lucknow | Web designing company in Lucknow

    ReplyDelete
  101. Web Design Sydney: It is a great sharing...I am very much pleased with the contents you have mentioned. I wanted to thank you for this great article.Logo Design Sydney, Logo Design in Coimbatore, Brochure Design in Coimbatore

    ReplyDelete
  102. Thanks for sharing this articles, Keep publishing your content and publish new content for good readers.Android Application Development Company

    ReplyDelete
  103. I would like to say that this blog really convinced me, you give me best information! Thanks, very good post.
    iPhone Application Development

    ReplyDelete
  104. I simply want to say I’m very new to blogs and actually loved you’re blog site. Almost certainly I’m going to bookmark your blog post . You absolutely come with great well written articles. Thanks a lot for sharing your blog.
    Digital marketing company in Lucknow

    ReplyDelete
  105. good article. I like to read this post because I met so many new facts about it actually. Thanks a lot. Android App Development Company Noida

    ReplyDelete
  106. The information you provide is really helpful. I am a regular reader of your blog.Mobile App development companies

    ReplyDelete
  107. This comment has been removed by the author.

    ReplyDelete
  108. when i am using my phone for running the application? what url i should use?

    ReplyDelete
  109. Thanks for the informative article. Like to read this blog often. Keep updating me about new technologies.
    web development Dubai

    ReplyDelete
  110. well-written and informative piece!. this blog is very helpful and we can take lots of ideas. Android App Development Company Noida

    ReplyDelete
  111. This is a very good tip especially to those fresh to the blogosphere.
    Simple but very precise info… Thanks for sharing this one.
    Custom Software Development Company in India

    ReplyDelete
  112. Information is too good and very usefull, thanks for sharing this wonderfull information
    best seo packages company in bangalore
    SEO Expert in Bangalore

    ReplyDelete
  113. This article is very much helpful and i hope this will be an useful information for the needed one. Keep on updating these kinds of informative things...
    PSD to Wordpress
    wordpress website development

    ReplyDelete
  114. This is an awesome post. Really very informative and creative contents. This concept is a good way to enhance the knowledge.

    Like it and help me to development very well Thank you for this brief explanation and very nice information. Well got good

    knowledge.
    Android Training in Gurgaon

    ReplyDelete
  115. I am grateful for this blog to give me much information with respect to my territory of work. I likewise need to make some expansion on this stage which must be in information of individuals who truly in require. Much appreciated.

    Website developers in bangalore| Website design companies in bangalore

    ReplyDelete
  116. Tech Intellectuals is a custom software development and staffing company. C# Development

    ReplyDelete
  117. Bulk sms is a most fastest service in india for promote your Business. these service applications follow a particular channel and bandwidth limitation in delivering the messages to multiple users at a single time, It sends instant SMS alerts to the bulk SMS provider via delivery reports per message send to the targeted customer.

    http://truebulksms.com./bulk-sms.html

    ReplyDelete
  118. This is a perfect blog to learners who are looking for android technology, check it once at Android Online Course

    ReplyDelete
  119. This Date Calculator app will allow you to calculate the duration like total days, total years, total weeks and total hours between any two given dates which makes the process in a easy and simple way. date counter

    ReplyDelete
  120. Nice Information thank you for Sharing useful information.
    Mobile App Development Companies in Delhi NCR

    ReplyDelete
  121. Great information for these blog!! And Very good work. It is very interesting to learn from to easy understood. Thank you for giving information. Please let us know and more information get post to link.
    Devops interview Questions

    ReplyDelete
  122. Bulk SMS services is the best mode to deliver your message to your customer then it is the newest choice for most of the companies these days.

    ReplyDelete
  123. Bulk SMS services is the best mode to deliver your message to your customer then it is the newest choice for most of the companies these days.

    ReplyDelete
  124. Great Post, Thanks for the information.

    Web Design & Development company offering the web services, So,people should analyze which company would provide best performance and which one is satisfy our expectation in web design services Delhi.



    Web Designing Company in Delhi, Web Development Company Delhi

    ReplyDelete
  125. It's amazing blog And useful for me Thanks
    . Net Online Course

    ReplyDelete
  126. Website Designing Company in Delhi offer services like responsive website design, ecommerce website design, custom website design in which our web designers deal directly with each customer.

    ReplyDelete
  127. Website Designing Company in Delhi offer services like responsive website design, ecommerce website design, custom website design in which our web designers deal directly with each customer.

    ReplyDelete
  128. Bulk SMS services is the best method to delivered your message to your audience hence it is the hottest choice for most of the company these days.

    ReplyDelete
  129. Hello.. your blog is great. I read your blog and like it very much. Thanks for sharing.
    ASP.NET training institute in Noida

    ReplyDelete
  130. Amazing post thanks for sharing the post.Your blogs are admirable and full of knowledge. Famous Astrologer in Sydney | Best Indian Astrologer in Sydney

    ReplyDelete
  131. I am grateful for this blog. Great work done. I am also a beginner and therefore this guide is very useful to me. I wanted to learn C# Web development and your blog helped me a lot in this.

    ReplyDelete
  132. This comment has been removed by the author.

    ReplyDelete
  133. Really an interesting and amazing post. Thanks for sharing this wonderful informative article here. I appreciate your hard work.Web Designing Company Bangalore | Website Design Company Bangalore

    ReplyDelete
  134. I really loved going through this article because it has steps which was defined clearly about mobile app development and am sure this will be helpful for the beginners.

    ecommerce website development in chennai

    ecommerce development chennai

    ReplyDelete
  135. "I really loved going through this article because it has steps which was defined clearly about mobile app development and am sure this will be helpful for the beginners.

    ecommerce website development in chennai

    ecommerce development chennai"

    ReplyDelete
  136. Nice blog to share. Much useful information in this blog. API development services.

    ReplyDelete
  137. Its a very amazing blog !!! This valuable and very informative blog is going to help the people to a great extent. Web Designing Company in Bangalore | Website Design Companies in Bangalore

    ReplyDelete
  138. Nice post. By reading your blog, i get inspired and this provides some useful information. Thank you for posting this exclusive post for our vision. 

    python training in chennai | python training in bangalore

    python online training | python training in pune

    python training in chennai

    ReplyDelete
  139. Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here.

    python training in chennai | python training in bangalore

    python online training | python training in pune

    python training in chennai

    ReplyDelete
  140. Some us know all relating to the compelling medium you present powerful steps on this blog and therefore strongly encourage contribution from other ones on this subject while our own child is truly discovering a great deal. Have fun with the remaining portion of the year.

    Data Science Training in Chennai
    Data science training in bangalore
    Data science online training
    Data science training in pune
    Data science training in kalyan nagar
    selenium training in chennai

    ReplyDelete
  141. Thank you for an additional great post. Exactly where else could anybody get that kind of facts in this kind of a ideal way of writing? I have a presentation next week, and I’m around the appear for this kind of data.
    Python training in marathahalli
    Python training in pune
    AWS Training in chennai

    ReplyDelete
  142. Thank you for allowing me to read it, welcome to the next in a recent article. And thanks for sharing the nice article, keep posting or updating news article.
    python training in rajajinagar
    Python training in btm
    Python training in usa
    Python training in marathahalli

    ReplyDelete
  143. After reading your post I understood that last week was with full of surprises and happiness for you. Congratz! Even though the website is work related, you can update small events in your life and share your happiness with us too.
    Python training in pune
    AWS Training in chennai
    Python course in chennai

    ReplyDelete
  144. Hmm, it seems like your site ate my first comment (it was extremely long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog. I as well as an aspiring blog writer, but I’m still new to the whole thing. Do you have any recommendations for newbie blog writers? I’d appreciate it.

    AWS Interview Questions And Answers

    AWS Training in Bangalore | Amazon Web Services Training in Bangalore

    Amazon Web Services Training in Pune | Best AWS Training in Pune

    AWS Online Training | Online AWS Certification Course - Gangboard

    ReplyDelete