Вот проблема
Звоню. net soap веб-сервис из мобильного приложения (с использованием библиотеки залпов). Некоторое время веб-служба вызывает дважды автоматически. Я помещаю журнал повсюду перед вызовом веб-службы и после ответа веб-службы, и я вижу, что в android нет возможности дважды вызвать веб-службу после проверки журнала.
. net soap веб-сервис, размещенный на сервере IIS. Я установил ограничение повтора для запроса залпа - 0 и 60 000 миллисекунд.
private void callWebServiceVolley (String methodName, HashMap params)
{попробуйте {VolleyJSONPost req = new VolleyJSONPost (Request.Method.POST, Config.URL + methodName, params, new Response.Listener () {
@Override
public void onResponse(JSONObject response) {
try {
if (_ProgressDialog.isShowing()) {
_ProgressDialog.dismiss();
}
if (response != null) {
PubFun.writeLog("[" + this.getClass().getName() + "] *MSG* FROM $callWebServiceVolley.onResponse$ :: Server response = " + response.toString());
switch (reqType) {
case REQUEST_SET_ONLINE_PUSH_OPEN_DATA:
clsSetSyncDataPushOnlineRes clsSetSyncDataPushOnlineRes = gson.fromJson(response.toString(), clsSetSyncDataPushOnlineRes.class);
if (clsSetSyncDataPushOnlineRes.Status.equalsIgnoreCase("1")) { //Success
if (clsSetSyncDataPushOnlineRes.Result.ORMSRes != null &&
clsSetSyncDataPushOnlineRes.Result.ORMSRes.size() > 0) {
for (int i = 0; i < clsSetSyncDataPushOnlineRes.Result.ORMSRes.size(); i++) {
sqlQuery = "";
sqlQuery = "update " + Config.TABLE_ORMS + " set DMSID = '"
+ clsSetSyncDataPushOnlineRes.Result.ORMSRes.get(i).DMSID
+ "' , Status = '" + Config.SYNC_STATUS_SUCCESS + "' where ORMSID = '"
+ clsSetSyncDataPushOnlineRes.Result.ORMSRes.get(i).SFAID + "'";
PubFun.writeLog("[" + this.getClass().getName() + "] $callWebServiceVolley$ :: sqlQuery = " + sqlQuery);
Config.mainDB.ExecuteQuery(sqlQuery);
}
}
if (clsSetSyncDataPushOnlineRes.Result.OCRDRes != null
&& clsSetSyncDataPushOnlineRes.Result.OCRDRes.size() > 0) {
for (int i = 0; i < clsSetSyncDataPushOnlineRes.Result.OCRDRes.size(); i++) {
sqlQuery = "";
sqlQuery = "update " + Config.TABLE_OCRD + " set CustomerID = '"
+ clsSetSyncDataPushOnlineRes.Result.OCRDRes.get(i).DMSID
+ "' , Active = 'true', " +
"Status = '" + Config.SYNC_STATUS_SUCCESS + "' where CustomerID = '"
+ clsSetSyncDataPushOnlineRes.Result.OCRDRes.get(i).SFAID + "'";
PubFun.writeLog("[" + this.getClass().getName() + "] $callWebServiceVolley$ :: sqlQuery = " + sqlQuery);
Config.mainDB.ExecuteQuery(sqlQuery);
sqlQuery = "";
sqlQuery = "update " + Config.TABLE_ORMS
+ " set CustomerID = '" + clsSetSyncDataPushOnlineRes.Result.OCRDRes.get(i).DMSID
+ "' where CustomerID = '" + clsSetSyncDataPushOnlineRes.Result.OCRDRes.get(i).SFAID + "'";
PubFun.writeLog("[" + this.getClass().getName() + "] $callWebServiceVolley$ :: sqlQuery = " + sqlQuery);
Config.mainDB.ExecuteQuery(sqlQuery);
sqlQuery = "";
sqlQuery = "update " + Config.TABLE_OZST + " set " +
" CustID = '" + clsSetSyncDataPushOnlineRes.Result.OCRDRes.get(i).DMSID + "'" +
" where CustID = '"
+ clsSetSyncDataPushOnlineRes.Result.OCRDRes.get(i).SFAID + "'";
Config.mainDB.ExecuteQuery(sqlQuery);
PubFun.writeLog("[" + this.getClass().getName() + "] $callWebServiceVolley$ :: sqlQuery = " + sqlQuery);
sqlQuery = "";
sqlQuery = "update " + Config.TABLE_ZST1 + " set " +
" CustID = '" + clsSetSyncDataPushOnlineRes.Result.OCRDRes.get(i).DMSID + "'" +
" where CustID = '"
+ clsSetSyncDataPushOnlineRes.Result.OCRDRes.get(i).SFAID + "'";
Config.mainDB.ExecuteQuery(sqlQuery);
PubFun.writeLog("[" + this.getClass().getName() + "] $callWebServiceVolley$ :: sqlQuery = " + sqlQuery);
sqlQuery = "";
sqlQuery = "update " + Config.TABLE_ACT4 + " set " +
" CustomerID = '" + clsSetSyncDataPushOnlineRes.Result.OCRDRes.get(i).DMSID + "'" +
" where CustomerID = '"
+ clsSetSyncDataPushOnlineRes.Result.OCRDRes.get(i).SFAID + "'";
Config.mainDB.ExecuteQuery(sqlQuery);
PubFun.writeLog("[" + this.getClass().getName() + "] $callWebServiceVolley$ :: sqlQuery = " + sqlQuery);
}
}
sqlQuery = "";
sqlQuery = "select count(*) from " + Config.TABLE_ORMS + " where Status = '" + Config.SYNC_STATUS_OPEN + "'";
int count = Integer.parseInt(PubFun.isNULL(Config.mainDB.GetRowCSV(sqlQuery), "0"));
PubFun.writeLog("[" + this.getClass().getName() + "] $callWebServiceVolley$ :: ORMS Count = " + String.valueOf(count));
if (count > 0) {
sendLocalToLivePushOPENBill();
} else {
sendLocalToLivePushUnConfirmBill();
}
} else { //Error
btnFragSyncUnload.setVisibility(View.VISIBLE);
if (alORMSIDS != null && alORMSIDS.size() > 0) {
for (int i = 0; i < alORMSIDS.size(); i++) {
sqlQuery = "";
sqlQuery = "update " + Config.TABLE_ORMS +
" set Status = '" + Config.SYNC_STATUS_OPEN +
"' where ORMSID = '" + alORMSIDS.get(i) + "'";
Config.mainDB.ExecuteQuery(sqlQuery);
}
}
if (alOCRDIDS != null && alOCRDIDS.size() > 0) {
for (int i = 0; i < alOCRDIDS.size(); i++) {
sqlQuery = "";
sqlQuery = "update " + Config.TABLE_OCRD +
" set Status = '" + Config.SYNC_STATUS_OPEN +
"' where CustomerID = '" + alOCRDIDS.get(i) + "'";
PubFun.writeLog("[" + this.getClass().getName() + "] $callWebService$ :: sqlQuery = " + sqlQuery);
Config.mainDB.ExecuteQuery(sqlQuery);
}
}
if (_ProgressDialog.isShowing()) {
_ProgressDialog.dismiss();
}
if (clsSetSyncDataPushOnlineRes.Result != null && clsSetSyncDataPushOnlineRes.Result.Type.equalsIgnoreCase("logout")) {
final DialogLogout dialogLogout = new DialogLogout(_activity);
dialogLogout.show();
dialogLogout.setCancelable(false);
dialogLogout.holder.tvMessage.setText(clsSetSyncDataPushOnlineRes.Error);
dialogLogout.holder.btnDialogLogout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
sqlQuery = "";
sqlQuery = "delete from " + Config.TABLE_USER_MASTER;
Config.mainDB.ExecuteQuery(sqlQuery);
_activity.startActivity(new Intent(_activity, ActivityLogin.class));
_activity.finish();
dialogLogout.dismiss();
}
});
dialogLogout.holder.btnDialogCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialogLogout.dismiss();
}
});
}
Toast.makeText(_activity, clsSetSyncDataPushOnlineRes.Error, Toast.LENGTH_SHORT).show();
}
break;
}
} else {
PubFun.showMessage(_activity, "", "Invalid response from server, please try again later");
}
} catch (Exception e) {
btnFragSyncUnload.setVisibility(View.VISIBLE);
if (_ProgressDialog.isShowing()) {
_ProgressDialog.dismiss();
}
PubFun.writeLog("[" + this.getClass().getName() + "] *ERROR* IN $onResponse$ :: error = " + e.toString());
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
try {
if (_ProgressDialog.isShowing()) {
_ProgressDialog.dismiss();
}
btnFragSyncUnload.setVisibility(View.VISIBLE);
if (error != null) {
PubFun.writeLog("[FragmentSyncData:onErrorResponse] Server error = " + error.toString());
PubFun.showMessage(_activity, "", "Server is not responding...");
}
} catch (Exception e) {
if (_ProgressDialog.isShowing()) {
_ProgressDialog.dismiss();
}
PubFun.writeLog("[" + this.getClass().getName() + "] *ERROR* IN $onErrorResponse$ :: error = " + e.toString());
}
}
});
req.setRetryPolicy(new DefaultRetryPolicy(
900000,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
requestQueue.add(req);
} catch (Exception e) {
if (_ProgressDialog.isShowing()) {
_ProgressDialog.dismiss();
}
btnFragSyncUnload.setVisibility(View.VISIBLE);
PubFun.writeLog("[" + this.getClass().getName() + "] *ERROR* IN $callWebServiceVolley$ :: error = " + e.toString());
}
}