Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 3 Jahren, 4 Monaten
Letzter Beitrag:
vor 3 Jahren, 4 Monaten
Beteiligte Autoren:
ccc2, Michael Drechsel, Steven Sitas, Alexandre Leclerc

Accessing a database via a Webservice Live Try

Startbeitrag von ccc2 am 28.01.2015 12:48

recently i received request from my customer to create a simple data entry program where where staff from remote can use.
web based app is the best solution . but i didn't do that. I choose to use WD19 to write windows application using webservice to access the database.
I have long read about such method and want to try in real live but it become the stupid things i ever build .

what i had found from this experiment?
1. alot of coding. (good bye to screentosource() and SourcetoScreen()). if you think not big deal , try to update 40 columns.

2. the speed is very very slow . even though the database and webservice is on different machine and I using native access . so slow that the program interface already finish drawing while data still loading in behind . give you async feeling.

3. primitive functions available . retrieve data using column number rather than column name is no fun . (good bye to select * from tbl)

4. alot strange error / bugs . for example i want to assign the value to a combo control .
combo_test..value = SQLGetCol("QRY1", 1)
error caught by exception is SQLGetCol should return a value . but if i assign it to a variable
test_id is string = SQLGetCol("QRY1", 1)
combo_test..value = test_id

i don't know what cause the error . i have 10 combo controls and only 2 give such error.

5. sqlconnectWS() and sqldisconnect() . should i use this everytime i want to access db or should i put this at startup/end of application .
i tried put at startup of application . sometime i get error "no connection" . so i try put it in begining/end of the scope of the process. this method resolve "no connection" but the webservice getting multiple connections from one program.

I endup spend 2 weeks for the program which in trial , because of slow become unusable .


Hi ccc2,
I haven't used web services myself, but if this is very-very slow, why don't you just open a port to your C/S HFSQL server and see how things go ...
At least you won't have the coding problem

von Steven Sitas - am 28.01.2015 12:59
Steven Sitas
Hi ccc2,
I haven't used web services myself, but if this is very-very slow, why don't you just open a port to your C/S HFSQL server and see how things go ...
At least you won't have the coding problem

I believe web service is the future method to access db . I want a real live test result to see whether it can handle simple data entry. I guess slow typing is possible but not for fast typer.

von ccc2 - am 28.01.2015 13:26
Hi ccc2,

Well, this way of coding is not that great for big applications since it uses SQL. But the other way to ode using WebServices is to go full MVP (model-view-presenter) with OOP programming.

We have a complete application developed that way. All data access is done at very low level in a class. We can change the data source anytime (like instead of doing direct i/o, use SQL queries) or we can build a simple webservice which will send the objetcs we need (customer object, order object) all filled by the server. To save, we sand the object back.

So there are about 3 ways to do it. The way you did it is one of them. But going OOP with an MVP mindset (even if not fully implemented) will take much more time to code.

Also, when you have funny errors, well, sometimes, deleting the .cpl folder and the .env file, doing a good recompile, is solving these issues (sometimes). But other times it's just weird, as you say, and further investigations are required.

Best regards,
Alexandre Leclerc

von Alexandre Leclerc - am 28.01.2015 15:35
Hi CCC2,

I use my own made webservices for 2 years. You are right, thats the future, because all traffic runs over port 80 or 443 and is http (s). You have no trouble with firewalls.

The programming overhead is +30 % compared to the native access (with an open HFSQL port), the speed -20 % (estimated)

What you need: windev and webdev. You can build your database, querys and so on as usual. But after this you create a UML modell and let windev build a class (or structure) from this and voila, your screentosource() is back again (you must link your tables to the array of structures. The UML takes care that your field names always up to date with your database/query.

The dataway is:

1. Put your query paramters in a structure (WD)
2. Call a httprequest (WD calls a AWP Website made with webdev)
3. The website runs a procedure and fills a array of structures and give this as a result back to windev
4. Windev runs souretoscreen() and show the results.

I use first the buildin "webservice" method (for that you don´t need webdev) but I found a major bug in V17.
Fabrice (thx again) put me in the right direction to use a simple AWP page for that.

von Michael Drechsel - am 28.01.2015 17:58
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.