jeudi 19 mars 2015

How to pass arraylist to soap webservice in android?

I have to insert sqlite's data to SQL server.First store all data in sqlite database and then clicking a button the entire data should be inserted in SQL server. My problem is, first row is getting inserted in all rows. For example, if I inserted three different rows in Sqlite,but the three rows have same first row values in Sql server.


I'm using array list in this one,I don't know how to pass those array list in soap web service.



push.setOnClickListener(new OnClickListener() {



@Override
public void onClick(View v) {
// TODO Auto-generated method stub


ArrayList<Details> lst=new ArrayList<Details>();

// Details det=new Details();

Database db=new Database(MainActivity.this);
SQLiteDatabase sb=db.getReadableDatabase();



Cursor cus=sb.rawQuery("select * from Auction",null);

cus.moveToFirst();


SoapObject request=new SoapObject(WSDL_TARGET_NAMESPACE,OPERATION_NAME);

for(int i=0;i<cus.getCount();i++)
{

Details det=new Details();


det.Boatnum= cus.getString(0).toString();
det. Buyername=cus.getString(1).toString();
det. amount= cus.getString(2).toString();

lst.add(det);



request.addProperty("Boatnum",det.Boatnum);
Log.e("u", det.Boatnum);

request.addProperty("Buyername",det.Buyername);
Log.e("y", det.Buyername);
request.addProperty("amount",det.amount);
Log.e("b", det.amount);


envelope=new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet=true;

for (int j = 0; j < request.getPropertyCount(); j++)

{

envelope.setOutputSoapObject(request.getProperty(j));


httpTransport = new HttpTransportSE(SOAP_ADDRESS);

}



try {

serviceCall();

}



catch (Exception exception) {





cus.moveToNext();

}
}
}




});

Aucun commentaire:

Enregistrer un commentaire