PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → [WD19] Zip in Stored Procedures
[WD19] Zip in Stored Procedures
Débuté par Michael Drechsel, 31 oct. 2014 09:02 - 8 réponses
Posté le 31 octobre 2014 - 09:02
Hi,

my WD14 project runs fine but needs an update to WD19. Thats the time to redesign the architecture.
In WD14 I use a direct connection with HFSQL over the Internet and at the server side runs a program which checks every 30 seconds if something happens. One of these things is receiving (and unzipping) ZIP-Files.

I want change the architecture to webservice + stored procedures at server side (to avoid starting a special program) , but I don´t know how to implement the zip and unzip because its not allowed in SP. One idea was to creating a windows service but I don´t want split the functionality in too many pieces ...

any ideas ?
Posté le 31 octobre 2014 - 12:24
Michael

You should be able to serialize the zip file into a buffer and send from the web service.

On receipt deserialise and unzip in your application.

Not actually tried it but no doubt Google will give some useful hints!
Posté le 31 octobre 2014 - 12:34
H Derek,

mmh, that means that is a synchron handling. Thats not good if the zip file is 2 GB with hundrets of files, because the user must wait till the process is finished.
Today I send the zip file and create a new record in the database with additional information. The server program polls every 30 seconds and handle this completly asynchron.

Can I call a webservice from a stored procedure ???
Posté le 31 octobre 2014 - 14:06
Michael
I do not see how you would call a webservice method from a stored procedure.

Can you not set up an 'Automatic Timer' as a background task to call the method.

Did a quick test and it is possible to load and send a zip file using webservices.....
Simple example of the Method code myArray is an array of 0 string myBufIN is Buffer myBufOUT is Buffer myBufIN = fLoadBuffer("C:\AAA\myfile.zip") ArrayAddLine(myArray,myBufIN) Serialize(myArray,myBufOUT,psdBinary)
Project code would be the reverse.

Not sure what serialization would do to the size of the file being transmitted but should not be a lot different if serialised as binary.
Posté le 31 octobre 2014 - 14:16
Hi Derek,

> I do not see how you would call a webservice method from a stored procedure.

according to the help it should be able, but I think I run into a timeout for large files. I need a call to a procedure without wait of a result.

Can you not set up an 'Automatic Timer' as a background task to call the method.


Yes, that was my first idea. But "automatic timer calls" are stored procedures and there is no "unzip"

Send and Receive ZIP files via webservice is not the problem.
Posté le 31 octobre 2014 - 14:20
Michael,
if 'starting a special program' is an issue, you could also wrap your existing code in a service.
Then it will run in the background, without the need to logon and run an executable.
Posté le 31 octobre 2014 - 14:28
Hi Arie,

yes that could be possible. But whats about error handling in a service ? If something went wrong can I see a error message from windev ? (Yes, I have my own error handling, but from time to time it could be happen that the application hangs with a GPF). I have no expierence with creating a windows service ...
Posté le 31 octobre 2014 - 16:17
Hi Michael,

just study the WDService example. It is quite complete and shows you how things work.
(found a bug almost immediately, pcsoft used a wait() statement which caused a 'hang' - must be replaced by servicewait() )

I digged into it last week, because I needed the same thing jou mentioned.
My client asked me to create a service for it, because they have monitor software to track failing services.
Afaik a GPF is handled by Windows and creates a logentry in the system-event logger.
Posté le 31 octobre 2014 - 16:34
Hi Arie,

ok, it looks like I have to explore another (dark) site of the PC Soft WLanguage jungle <img src="/NG2013_WEB/ui/smiley/1.gif" align=absmiddle border=0 alt=":-)">