Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 1 Monat, 2 Wochen
Letzter Beitrag:
vor 1 Monat, 1 Woche
Beteiligte Autoren:
André Labuschagné, Fabrice Harari, KenKnight

WDM21 - Deserialize Show Stopper

Startbeitrag von André Labuschagné am 30.10.2017 06:44

Hi All

I am needing some advice on deserialization with mobile apps. These apps collect data from a web service [also written in WX]. The data is serialized on server side and de-serialized on the app when received. If there is no data to send from the server side then a message is received and no de-serialisation is triggered. If data is send then the de-serialisation is triggered. And here is the problem. Not often but sometimes there is data but the de-serialization fails. And here is the rub - the same device when collecting the data again straight after the failure will successfully get the data and de-serialize it. I have absolutely no idea if the serialisation is failing on the server or the packet is somehow broken before being received by the device. What I am looking for are checks to make sure that the data can be de-serialised before actually attempting to de-serialize it. The error that de-serialisation has failed is traumatic to the end user. Is there anyway to supress the error message on the device or do an integrity test to see if the data can be de-serialised. The format is always xml. The error is Wrong serialization format. There is always only one format used. I am guessing that something has gone wrong when collecting the data.

Any ideas?




Hi André,

I am not using the serialize deserialize functions for my system, so all the things following are just ideas :

- as you are telling us that the same device fails then succeed on the same exact data, it looks like transmission is your problem. To verify that, I would create a small app that does only that: receive and deserialize the same data over and over again, non stop and let it run on the device in question for several days. If you have the problem, then you know that your analysis is correct and the transport is the problem. If not, you probably haven't seen something somewhere.

- One way of controlling that the data is correct before deserializing it is to add a checksum to the packet, and verify that checksum before deserializing. As there is a checksum function in wlanguage, it's just a few lines of code (see help)

- One way of preventing the error message to appear is to use the 'when exception' system (see help)

Finally, I remember having seen messages in the french forums about problem with the deserialize function in some specific cases, depending on the content of the serialized data. However, if your claim that the SAME data is successfully deserialized after the problem is correct, you cannot be in that case.

And if you want to get rid of the serialize function alltogether, you can look in WXreplication for an alternate method.

Best regards

von Fabrice Harari - am 30.10.2017 11:09
Hi Fabrice

Thanks a ton. I can work with that. But perhaps need to explain a bit further.

The client has say 2,000 clients of their own. Of these 2,000 clients running a mobile version and a win32 version of the same program totalling say 4,000 installations few will receive this error. And the few that receive the error will only receive it occasionally or receive it once and then never again. I am convinced that it is a transport problem.

So I am keen to check the completeness of the deliver, check for that completion and only apply deserialization if I am certain the packet is intact. So I am going to apply your checksum and with exception. If I can first test for completeness that will be one check. And then if that fails and I can catch the error and display something meaningful that will be great. I just do not want the end user to see this elaborate message with line numbers and functions listed. Next time they press the button to retrieve the data it is likely to work.

Replication is not on the cards for this.

Thanks for your help.


von André Labuschagné - am 30.10.2017 11:28
Hi André,

We use serialize / deserialize extensively in our multi-platform apps. Fabrice is dead on regarding his suggested methods of testing for it. We chose the 'when exception' method and will attempt to make the call a second time if the first one appears to have succeeded but is missing information. If it fails a second time we log to a global logging server through http so we can try and get a view of exactly what is going on.

It really is worth building a class or set of procedures that process these types of calls both response and request so you can automate the complete process of handling of all calls in the apps.

Also worth mentioning are the UTF-8 / Ansi issues that tend to cause issues when you least expect them.


von KenKnight - am 30.10.2017 12:34
Hi André,

I was not saying that you should use a replication, just that in wxreplication (which is using a REST type webserveice to communicate ), I'm not using serialize, but instead a CODED method that works in all cases/environment (deserialize was not available on all my targets when I wrote it, and it would be wasteful when replicating edit/partial records)...

So if the problem comes from that method, the word around is to NOT USE IT, and instead use a version of the code I'm using in wxreplication.

Best regards

von Fabrice Harari - am 30.10.2017 14:17
Hi Fabrice



von André Labuschagné - am 06.11.2017 08:40
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.