Hi all,
I am developing a form based solution, using c#, which will read and write data from SQLite database to Dynamics NAV 2015 database, vice versa.
In a part of my solution, I need to check whether there is any new record in a NAV database table every second. If yes, then I need to replicate that record as soon as possible in my SQLite database. So I read the NAV records from my application using NAV’s SOAP Web service and write the same information to my SQLite database.
Actually this is working as expected except for the interval between the new record being written to NAV database until it is read through the SOAP Web service. It is about 30 second (localhost connection) until the readmultiple can get the new inserted or modified records. In the real life environment, I need the records available in the SQLite database less than a couple of seconds (close to real-time if possible).
Here is the function I use to consume the SOAP webservice and update my SQLiteDatabase:
private void UpdateCallEntryFromDynamics()
{
QueueCallEntryService_Service CallEntryWS = new QueueCallEntryService_Service();
CallEntryWS.Credentials = new NetworkCredential("user", "xxxxxx");
List<QueueCallEntryService_Filter> CallEntryFilters = new List<QueueCallEntryService_Filter>();
QueueCallEntryService_Filter StatusFilter = new QueueCallEntryService_Filter();
StatusFilter.Field = QueueCallEntryService_Fields.Status;
StatusFilter.Criteria = "NEW";
CallEntryFilters.Add(StatusFilter);
QueueCallEntryService.QueueCallEntryService[] Entries = CallEntryWS.ReadMultiple(CallEntryFilters.ToArray(), null, 200);
QueueCallEntryService.QueueCallEntryService CallEntry = new QueueCallEntryService.QueueCallEntryService();
foreach (QueueCallEntryService.QueueCallEntryService Entry in Entries)
{
connectToDatabase();
string sql =
"INSERT INTO CallEntry"
+ "(Date,EntryNo,QueueEntryNo,QueueTypeID,QueueNo,CounterNo,Status,CallTime)"
+ "VALUES ("
+ "'" + Entry.Date.ToString("yyyy-MM-dd") + "'"
+ ",'" + Entry.EntryNo.ToString() + "'"
+ ",'" + Entry.QueueEntryNo.ToString() + "'"
+ ",'" + Entry.QueueTypeID.ToString() + "'"
+ ",'" + Entry.QueueNo.ToString() + "'"
+ ",'" + Entry.CounterNo.ToString() + "'"
+ ",'NEW'"
+ ",'" + Entry.Time.ToString("hh:mm:ss") + "'"
+ ")";
SQLiteCommand cmd = new SQLiteCommand(sql, Conn);
cmd.ExecuteNonQuery();
CallEntry = Entry;
CallEntry.Status = "ON QMS";
CallEntryWS.Update(ref CallEntry);
}
CallEntryWS.Dispose();
CallEntryFilters.Clear();
}
Is there any information regarding how we can reduce the time interval? Thanks in advance.
Regrads,
Philipus
0
Answers
[*] Compile the page
[*] un-check and recheck the publish on web service page
[*] Restart the service instance
[*] Update the web reference on Visual Studio projects
When I test my solution, new record (insert / modified) immediately read on readmultiple command.
Franz Kalchmair, MVP
Alias: Jonathan Archer
please like / agree / verify my answer, if it was helpful for you. thx.
Blog: http://moxie4nav.wordpress.com/
Carsten
==> How To Ask Questions The Smart Way
This post is my own opinion and does not necessarily reflect the opinion or view of my employer.
yes, this might be the case. I often separate Client service and the SOAP web service. Is there anyway we could reduce the cache synchronization period?
thx.
Carsten
==> How To Ask Questions The Smart Way
This post is my own opinion and does not necessarily reflect the opinion or view of my employer.