Click here to Skip to main content
15,916,030 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
We have web service for mobile app and it was working fine till we change the server. Recently we have moved our server to Azure platform VM and SQL MI after that we are facing the problem in the web service response. The web service one response wrongly mapping to another request's response e.g when user 1 hitting the web service with respective Id value and same time user2 hit with his ID then user 1 and user 2 both getting the same response of either user1 or user2.This issue occurs only 10 out of 200 hits approx. Kindly suggest me if anything wrong or where the mistake has done. below is the code, (here I have included some logs for finding the response)

As per the below function "GetJobAssignmentDetails_fhits" the "Model_No" number is the primary key value to get the respective details of the user. This is the function used to get the details like the above mentioned(custid, address et.,) for the respective user.

We also check that mobile device angle, but it seems there is no issue in the mobile app because we used a browser to hit the web service with relevant parameter using wsdl and there itself response is wrong. we used to hit the web service through a browser with a unique parameter value of 2 different users in desktop continuously and there itself we received the same response for each at some point of time.

Below is the code,

What I have tried:

C#
<pre>public class JobSeq
{
private string sJobCode;
private string sCustCode;
private string sCustName;
private string sContactPerson;
private string sContactNo;
private string sCustAddress;
private int sJSno;
[System.Xml.Serialization.XmlElementAttribute]
public int JSno
{
get { return sJSno; }
set { sJSno = value; }
}
//Job Code
[System.Xml.Serialization.XmlElementAttribute]
public string JobCode
{
get { return sJobCode; }
set { sJobCode = value; }
}
//Customer Code
[System.Xml.Serialization.XmlElementAttribute]
public string CustomerCode
{
get { return sCustCode; }
set { sCustCode = value; }
}
//Customer Name
[System.Xml.Serialization.XmlElementAttribute]
public string CustomerName
{
get { return sCustName; }
set { sCustName = value; }
}
//Customer Address
[System.Xml.Serialization.XmlElementAttribute]
public string Address
{
get { return sCustAddress; }
set { sCustAddress = value; }
}
//Contact Person
[System.Xml.Serialization.XmlElementAttribute]
public string ContactPerson
{
get { return sContactPerson; }
set { sContactPerson = value; }
}
//Contact No
[System.Xml.Serialization.XmlElementAttribute]
public string ContactNo
{
get { return sContactNo; }
set { sContactNo = value; }
}
[System.Xml.Serialization.XmlElementAttribute]
public string RowCount { get; set; }
[System.Xml.Serialization.XmlElementAttribute]
public string TotRowCount { get; set; }
[System.Xml.Serialization.XmlElementAttribute]
public string NewJob { get; set; }
[System.Xml.Serialization.XmlElementAttribute]
public string Accecptjob { get; set; }
}
[WebMethod(Description = "Testing", CacheDuration = 0, EnableSession = false)]
public JobDetails_Test GetJobAssignmentDetails_fhits(string Model_No, bool isHistory, string utcStTime, string utcEndTime, string currLatLng, int PageNo, int RowCount, bool isNewjob)
{
// Trinetra_App.BAL.Configurations objC = new Trinetra_App.BAL.Configurations();
DateTime dtStTime = DateTime.Now;
ModelNumber = Model_No.ToString();
DataSet ds = new DataSet();
SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["ConString"].ToString());
SqlCommand command = new SqlCommand();
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "rvlf_sp_GetDetails1";
command.Connection = conn;
DataTable dtTable = new DataTable();
JobDetails_Test objJobDetails_std1 = new JobDetails_Test();
Hashtable param_std1 = new Hashtable();
try
{
param_std1.Add("@cModelCode", Model_No);
command.Parameters.AddWithValue("@cModelCode", Model_No);
if (isHistory == true)
{
command.Parameters.AddWithValue("@bIsHistory", "1");
command.Parameters.AddWithValue("@dStDate", utcStTime);
command.Parameters.AddWithValue("@dEndDate", utcEndTime);
param_std1.Add("@bIsHistory", "1");
param_std1.Add("@dStDate", utcStTime);
param_std1.Add("@dEndDate", utcEndTime);
}
else
{
command.Parameters.AddWithValue("@cCurrLatLng", currLatLng);
command.Parameters.AddWithValue("@Isnewjob", isNewjob);
param_std1.Add("@cCurrLatLng", currLatLng);
param_std1.Add("@Isnewjob", isNewjob);
}
//ds = objC.ExecuteDataSet(param_std1, "rvlf_sp_GetJobDetails1", true);
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = command;
adapter.Fill(ds);
if (ds.Tables.Count != 0)
{
if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
{
StringWriter sw = new StringWriter();
ds.WriteXml(sw, XmlWriteMode.IgnoreSchema);
List<JobSeq> objJobAssignment_std1 = new List<JobSeq>();
PagedDataSource objPds = new PagedDataSource();
objPds.DataSource = ds.Tables[0].DefaultView;
objPds.AllowPaging = true;
objPds.PageSize = RowCount;
objPds.CurrentPageIndex = PageNo - 1;
foreach (DataRow item in ds.Tables[0].Rows)
{
JobSeq objJobSeq = new JobSeq();
objJobSeq.JobCode = item["JobCode"].ToString();
objJobSeq.JSno = Convert.ToInt32(item["Sno"].ToString());
objJobSeq.CustomerCode = item["CustId"].ToString();
objJobSeq.CustomerName = item["CustName"].ToString();
objJobSeq.Address = item["CustomerAddress"].ToString();
objJobSeq.ContactPerson = item["ContactPerson"].ToString();
objJobSeq.ContactNo = item["Phone"].ToString();
if (isHistory)
{
objJobSeq.SignatureBytes = new byte[] { };
objJobSeq.AttachmentBytes = new byte[] { };
}
objJobAssignment_std1.Add(objJobSeq);
}
objJobDetails_std1.Assignment = objJobAssignment_std1;
if (ds.Tables[1] != null && ds.Tables[1].Rows.Count > 0)
{
objJobDetails_std1.NewJob = Convert.ToInt32(ds.Tables[1].Rows[0]["NewJob"].ToString());
objJobDetails_std1.Accecptjob = Convert.ToInt32(ds.Tables[1].Rows[0]["Accecptjob"].ToString());
}
else
{
objJobDetails_std1.NewJob = 0;
objJobDetails_std1.Accecptjob = 0;
}
objJobDetails_std1.Response_Status = "Success";
}
else
{
objJobDetails_std1.Response_Status = "Data not available";
}
}
else
{
objJobDetails_std1.Response_Status = "Data not available";
}
}
catch (Exception ex)
{
objJobDetails_std1.Response_Status = ex.Message.ToString();
StackFrame stackFrame = new StackFrame();
MethodBase methodBase = stackFrame.GetMethod();
ModelNumber = string.Empty;
}
finally
{
param_std1.Clear();
param_std1 = null;
ds.Dispose();
ds = null;
}
return objJobDetails_std1;
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900