title: making KvmSerializable object to request SOAP service
body: <p>I just want to request SOAP service from <strong><em>android</em></strong> and I am passing the data with the help of <a href="http://kobjects.org/ksoap2/doc/api/org/ksoap2/serialization/KvmSerializable.html" rel="nofollow">KvmSerializable</a> object.</p>
  
  <p>I am doing it perfectly with this reference <a href="http://seesharpgears.blogspot.in/2010/10/ksoap-android-web-service-tutorial-with.html" rel="nofollow">link</a> when I want to send simple data such as in Case 1.</p>
  
  <p>But when I want to send complex data to SOAP service I am not knowing how to form KvmSerializable object such as in Case 2. I got some ref <a href="https://code.google.com/p/ksoap2-android/wiki/CodingTipsAndTricks#sending/receiving_array_of_complex_types_or_primitives" rel="nofollow">link</a> but unable to solve it.</p>
  
  <h2><strong>Case 1:</strong></h2>
  
  <p><em>data to send:</em></p>
  
  <pre><code>&lt;UserDetails&gt;
     &lt;name&gt;string&lt;/name&gt;
     &lt;reportitem&gt;string&lt;/reportitem&gt;
     &lt;reportid&gt;long&lt;/reportid&gt;  
  &lt;/UserDetails&gt;
  </code></pre>
  
  <p><em>KvmSerializable class which I have written:</em></p>
  
  <pre><code>import org.ksoap2.serialization.KvmSerializable;
  import org.ksoap2.serialization.PropertyInfo;
  
  import java.util.Hashtable;
  
  public class UserDetails implements KvmSerializable {
  
  private String name;
  private String reportitem;
  private String reportid;
  
  public static final int NAME = 0;
  public static final int REPORT_ITEM = NAME + 1;
  public static final int REPORT_ID = REPORT_ITEM + 1;
  public static final int PARAM_COUNT = REPORT_ID + 1;
  
  @Override
  public Object getProperty(int param_pos) {
  
      switch (param_pos) {
          case NAME:
              return name;
  
          case REPORT_ITEM:
              return reportitem;
  
          case REPORT_ID:
              return reportid;
      }
      return null;
  }
  
  @Override
  public int getPropertyCount() {
      return PARAM_COUNT;
  }
  
  @Override
  public void setProperty(int param_pos, Object val) {
  
      switch (param_pos) {
          case NAME:
              name = Long.parseLong(val.toString());
              break;
  
          case REPORT_ITEM:
              reportitem = val.toString();
              break;
  
          case REPORT_ID:
              reportid = val.toString();
              break;
      }
  }
  
  @Override
  public void getPropertyInfo(int param_pos, Hashtable hashtable, PropertyInfo propertyInfo) {
  
      switch (param_pos) {
          case NAME:
              propertyInfo.type = PropertyInfo.STRING_CLASS;
              propertyInfo.name = "name";
              break;
  
          case REPORT_ITEM:
              propertyInfo.type = PropertyInfo.STRING_CLASS;
              propertyInfo.name = "reportitem";
              break;
  
          case REPORT_ID:
              propertyInfo.type = PropertyInfo.LONG_CLASS;
              propertyInfo.name = "reportid";
              break;
      }
  }
  }
  </code></pre>
  
  <h2><strong>Case 2:</strong></h2>
  
  <p><em>data to send:</em></p>
  
  <pre><code>&lt;organization&gt;
      &lt;orgname&gt;string&lt;/orgname&gt;
      &lt;address&gt;sring&lt;/address&gt;
      &lt;users&gt;
        &lt;user&gt;
           &lt;name&gt;string&lt;/name&gt;
           &lt;age&gt;int&lt;/age&gt;
           &lt;Address&gt;
              &lt;addr1&gt;string&lt;/addr1&gt;
              &lt;addr2&gt;string&lt;/addr2&gt;
           &lt;/Address&gt;
        &lt;/user&gt;
        &lt;user&gt;
           &lt;name&gt;string&lt;/name&gt;
           &lt;age&gt;int&lt;/age&gt;
           &lt;Address&gt;
              &lt;addr1&gt;string&lt;/addr1&gt;
              &lt;addr2&gt;string&lt;/addr2&gt;
           &lt;/Address&gt;
        &lt;/user&gt;
      &lt;/users&gt;
  &lt;/organization&gt;
  </code></pre>
  
  <p>In this case I want to send this complex data to SOAP service through KvmSerializable object. Can any one help how can we make it through KvmSerializable...?</p>
  
  <p>Thank you.</p>