Get data only from some soap objects in android and show in listview

0

I am consuming SOAP services and this is the result that the soap object shows me:

 getContractsByDocSubscriberResponse {
  return = anyType {
    codError = 0;
    msjError = OK;
    dataContracts = anyType {
      contract = 2080086;
      products = anyType {
        commercialPlan = LINEA SOCIO;
        service = 7004 - Telefonía Fija;
        serviceNumber = 4586697;
        status = 3 - Retirado;
      };
    };
    dataContracts = anyType {
      contract = 2175754;
      products = anyType {
        commercialPlan = LINEA ADICIONAL;
        creationDate = 2010 - 10 - 19 T15: 39: 45 - 04: 00;
        cutState = 1 - CONEXIÓN;
        productId = 20175754;
        service = 7004 - Telefonía Fija;
        serviceNumber = 4309189;
        status = 1 - Activo;
      };
      products = anyType {
        commercialPlan = B.A.ADSL;
        creationDate = 2015 - 09 - 09 T15: 42: 47 - 04: 00;
        cutState = 1 - CONEXIÓN;
        productId = 95224313;
        service = 7019 - Internet;
        serviceNumber = 95224313;
        status = 1 - Activo;
      };
      products = anyType {
        commercialPlan = TV CABLE;
        service = 7020 - Televisión;
        serviceNumber = 95135569;
        status = 3 - Retirado;
      };
    };
  };
}

The question is that I want to get only the contract numbers and show them in a listview and try other examples that are on the page but I only get the first contract that is in the first dataContracts and I can not access the second to show them both in a list, I'm working with Asyntask and this is part of the onpostexecute () code:

    Log.d(TAG, "datos contrato: " + resultString);

      SoapObject getProperty0=(SoapObject)resultString.getProperty(0);
                SoapObject getDataOrdenes=(SoapObject)getProperty0.getProperty("dataContracts");
                clientes=new String[getDataOrdenes.getPropertyCount()];

                //inicia datos para listview
                for ( int i=0;i<getDataOrdenes.getPropertyCount();i++ ) {

                    planCom = getDataOrdenes.getProperty("contract").toString();


                    clientes[i]="Contrato: "+planCom;


                }

                ArrayAdapter<String> adaptador = ne

w ArrayAdapter<String>(ContratoLista.this,
                    android.R.layout.simple_list_item_1, clientes);

            listView.setAdapter(adaptador);}
    
asked by Jimena Vidal 21.03.2017 в 23:37
source

0 answers