title: Android: How to send object class to web service
body: <p>I'm trying to send an Object Class to my ASP.NET Web Service using ksoap2-android.</p>
  
  <p><strong>SOAP request:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
      &lt;soap:Body&gt;
          &lt;sendTest xmlns="http://testing.com/"&gt;
              &lt;test&gt;
                  &lt;Id&gt;int&lt;/Id&gt;
                  &lt;Name&gt;string&lt;/Name&gt;
                  &lt;Age&gt;int&lt;/Age&gt;
              &lt;/test&gt;
          &lt;/sendTest&gt;
      &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p><strong>C# class:</strong></p>
  
  <pre><code>public class eTest
  {
      int id;
      string name;
      int age;
  
      public int Id
      {
          get { return id; }
          set { id = value; }
      }
      public string Name
      {
          get { return name; }
          set { name = value; }
      }
      public int Age
      {
          get { return age; }
          set { age = value; }
      }
  }
  </code></pre>
  
  <p><strong>Java class:</strong></p>
  
  <pre><code>public class Test implements KvmSerializable {
      private int id;
      private String name;
      private int age;
  
      public int getId() {
          return id;
      }
      public void setId(int id) {
          this.id = id;
      }
      public String getName() {
          return name;
      }
      public void setName(String name) {
          this.name = name;
      }
      public int getAge() {
          return age;
      }
      public void setAge(int age) {
          this.age = age;
      }
  
      @Override
      public Object getProperty(int index) {
          switch (index) {
              case 0:
                  return getId();
              case 1:
                  return getName();
              case 2:
                  return getAge();
          }
          return null;
      }
  
      @Override
      public void getPropertyInfo(int index, Hashtable properties, PropertyInfo info) {
          switch (index) {
              case 0:
                  info.name = "Id";
                  info.type = PropertyInfo.INTEGER_CLASS;
                  break;
              case 1:
                  info.name = "Name";
                  info.type = PropertyInfo.STRING_CLASS;
                  break;
              case 2:
                  info.name = "Age";
                  info.type = PropertyInfo.INTEGER_CLASS;
                  break;
              default:
                  break;
          }
      }
  
      @Override
      public int getPropertyCount() {
          return 3;
      }
  
      @Override
      public void setProperty(int index, Object value) {
          switch (index) {
              case 0:
                  setId(Integer.parseInt(value.toString()));
                  break;
              case 1:
                  setName(value.toString());
                  break;
              case 2:
                  setAge(Integer.parseInt(value.toString()));
                  break;
              default:
                  break;
          }
      }
  }
  </code></pre>
  
  <p><strong>AsyncTask:</strong></p>
  
  <pre><code>public class MyAsyncTask extends AsyncTask&lt;Void, Void, Boolean&gt; {
      @Override
      protected Boolean doInBackground(Void... params) {
          String SOAP_ACTION = "http://testing.com/sendTest";
          String METHOD_NAME = "sendTest";
          String NAMESPACE = "http://testing.com/";
          String URL = "http://testing.com/WebService.asmx";
  
          Test test = new Test();
          test.setId(1);
          test.setName("Charly");
          test.setAge(26);
  
          PropertyInfo property = new PropertyInfo();
          property.setName("test");
          property.setType(Test.class);
          property.setValue(test);
  
          SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
          request.addProperty(property);
  
          SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
          envelope.dotNet = true;
          envelope.setOutputSoapObject(request);
  
          HttpTransportSE Transport = new HttpTransportSE(URL);
          try {
              Transport.call(SOAP_ACTION, envelope);
              return true;
          } catch (Exception e) {
              Log.e("ERROR", "KSOAP2", e);
          }
          return false;
      }
  }
  </code></pre>
  
  <p>Where is the error? I don't get any exception in Logcat. <code>sendTest</code> method is an INSERT INTO Sql Query, but when I execute the AsyncTask, nothing happens.</p>