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:
<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; }
}
[System.Xml.Serialization.XmlElementAttribute]
public string JobCode
{
get { return sJobCode; }
set { sJobCode = value; }
}
[System.Xml.Serialization.XmlElementAttribute]
public string CustomerCode
{
get { return sCustCode; }
set { sCustCode = value; }
}
[System.Xml.Serialization.XmlElementAttribute]
public string CustomerName
{
get { return sCustName; }
set { sCustName = value; }
}
[System.Xml.Serialization.XmlElementAttribute]
public string Address
{
get { return sCustAddress; }
set { sCustAddress = value; }
}
[System.Xml.Serialization.XmlElementAttribute]
public string ContactPerson
{
get { return sContactPerson; }
set { sContactPerson = value; }
}
[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)
{
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);
}
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;
}