title: Send a class object to a webservice and recieve a response as a list in java
body: <p>I am trying to create an android application using eclipse with <code>ksoap</code> and i want to sent a class object as a parameter in a method of a web service and take a list as a response.
  I find these <a href="http://seesharpgears.blogspot.com.es/2010/10/ksoap-android-web-service-tutorial-with.html" rel="nofollow">link1</a> <a href="http://pic.dhe.ibm.com/infocenter/pim/v9r0m0/index.jsp?topic=/com.ibm.pim.dev.doc/webservices/pim_tsk_samplejavaapi3.html" rel="nofollow">link2</a> but i didn't manage to write a code that works.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>package com.testcustomer11;
  
  import org.ksoap2.SoapEnvelope;
  import org.ksoap2.serialization.SoapObject;
  import org.ksoap2.serialization.SoapSerializationEnvelope;
  import org.ksoap2.transport.HttpTransportSE;
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.TextView;
  
  public class MainActivity extends Activity 
  { 
  
  private static String SOAP_ACTION1 =     
  "http://tempuri.org/GetCustomer";
  private static String NAMESPACE = "http://tempuri.org/";
  private static String METHOD_NAME1 = "GetCustomer";
  private static String URL = "http://localhost:8000/Service?wsdl";
  
  Button button1;
  EditText editText2;
  TextView TextView01;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
  
      button1 = (Button)findViewById(R.id.button1);
  
  
      button1.setOnClickListener(new View.OnClickListener()
      {
          @Override 
          public void onClick(View v)
          {
          editText2 = (EditText)findViewById(R.id.editText2);
  
          TextView01 = (TextView)findViewById(R.id.TextView01);
  
          //Initialize soap request + add parameters
          SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME1);
  
  
          Customer C = new Customer();
  
  
  
          request.addProperty("customer",editText2.getTag());
  
          //Declare the version of the SOAP request
          SoapSerializationEnvelope envelope = new               
          SoapSerializationEnvelope(SoapEnvelope.VER11);                        
  
  
          envelope.setOutputSoapObject(request);
          envelope.dotNet = true;
  
          envelope.addMapping(NAMESPACE, "Customer",new Customer().getClass());
  
          HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
  
          androidHttpTransport.debug = true;
  
          try {
              //this is the actual part that will call the webservice
              androidHttpTransport.call(SOAP_ACTION1, envelope);
  
              // Get the SoapResult from the envelope body.
              SoapObject response = (SoapObject)envelope.bodyIn;
  
              SoapObject soapResult = (SoapObject)response.getProperty(0);
  
              for (int i = 0; i &lt; soapResult.getPropertyCount(); i++) {
              SoapObject res = (SoapObject) response.getProperty(i);
                  C.Code = res.getProperty(0).toString();
                  C.Name = res.getProperty(1).toString();
                  C.VATNo = res.getProperty(2).toString();
                  C.PriceList = res.getProperty(3).toString();
                  SoapObject so = (SoapObject) soapResult.getProperty(i);
                  so.getProperty("Code");
  
              }
              TextView01.setText(response.toString());
          }
          catch (Exception e) 
          {
              //TextView01.setText("EXCEPTION");
              e.printStackTrace();
          }
          }
          });    
          }
          }
  </code></pre>
  
  <p>and the Customer class:</p>
  
  <pre><code>package com.testcustomer11;
  
  import java.util.Hashtable;
  import org.ksoap2.serialization.KvmSerializable;
  import org.ksoap2.serialization.PropertyInfo;
  
  public class Customer extends MainActivity implements KvmSerializable
  {
  public int Code;
  public String Name;
  public String VATNo;
  public String PriceList;
  
      public Customer(){}
  
  public Customer(int cCode, String cName, String cVATNo, String cPriceList) {
  
      Code = cCode;
      Name = cName;
      VATNo = cVATNo;
      PriceList = cPriceList;
  }
  
  public Object getProperty(int arg0) {
  
      switch(arg0)
      {
      case 0:
          return Code;
      case 1:
          return Name;
      case 2:
          return VATNo;
      case 3:
          return PriceList;
      }
      return null;
  }
  
  public int getPropertyCount() {
      return 3;
  }
  
  public void getPropertyInfo(int index, Hashtable arg1, PropertyInfo info) {
      switch(index)
      {
      case 0:
          info.type = PropertyInfo.INTEGER_CLASS;
          info.name = "Code";
          break;
      case 1:
          info.type = PropertyInfo.STRING_CLASS;
          info.name = "Name";
          break;
      case 2:
          info.type = PropertyInfo.STRING_CLASS;
          info.name = "VATNo";
          break;
      case 3:
          info.type = PropertyInfo.STRING_CLASS;
          info.name = "PriceList";
          break;
      default:break;
      }
  }
  
  public void setProperty(int index, Object value) {
      switch(index)
      {
      case 0:
          Code = Integer.parseInt(value.toString());
          break;
      case 1:
          Name = value.toString();
          break;
      case 2:
          VATNo = value.toString();
          break;
      case 3:
          PriceList = value.toString();
          break;
      default:
          break;
      }
     }
   }
  </code></pre>
  
  <p>When i run it in the emulator gives me this message <code>"GetCustomerResponse{GetCustomerResult=anyType{};}"</code>.</p>
  
  <p>Any ideas??</p>