I want to update the local SQLite database table(masters) in my device with MS SQL database table in the Server. Here am using SOAP Service. If any new values are inserted in the server then on click of a button it must sync and update the new values in my table. I want to know how to do it and below is the METHOD which I used to call the web service.
Here MANUFACTURERID and MANUFACTURERDESC are the two columns which I want to update.
I used the below link for reference and there is a class TaskAsync.java used. I want to know what I must write inside that class to call the web service. As am new to java please help me how to do this sync. Thanx in advance
http://stackoverflow.com/questions/14453577/sync-in-android-sqlite-and-sql-server-crud-operation-in-two-ways
**DATABASEHELPER.JAVA**
public void syncUsers(){
try{
String response = new **TaskAsync()**.execute("http://tempuri.org/ISave/SyncMaster").get();
Log.d("response",response);
String myPath = DB_PATH + DB_NAME;
String tablename = "ManufacturerDesc";
myDataBase = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READWRITE);
myDataBase.delete(tablename, null, null);
ContentValues values = new ContentValues();
values.put("MANUFACTURERDESC",as_Manufacturer);
values.put("MANUFACTURERID", asManufactureId);
//values.put("MANUFACTURERID", value);
long status = myDataBase.insert(tablename, " ", values);
Log.d("database", Long.toString(status));
myDataBase.close();
}catch (Exception e){
e.printStackTrace();
}
}
**SOAPWebservice.java**
public SoapPrimitive manMaster(String manmas, String manmasid)
{
SoapPrimitive result = null;
try
{
SoapObject request = new SoapObject("http://tempuri.org/","SyncMaster");
request.addProperty("MANUFACTURERID", manmasid);//soap object
request.addProperty("MANUFACTURERDESC" , manmas);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
envelope.dotNet = true;
HttpTransportSE androidHttpTransport = new HttpTransportSE(url);
androidHttpTransport.call("http://tempuri.org/ISave/SyncMaster",envelope);
Log.e("WEB", androidHttpTransport.toString());
result = (SoapPrimitive)envelope.getResponse();
return result;
}
catch(Exception e){
Log.e("WebService","Error",e);
e.printStackTrace();
return null;
}
}