[WD19] Zip in Stored Procedures

Startbeitrag von Michael Drechsel am 31.10.2014 08:02


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 ?



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!

von DerekT - am 31.10.2014 11:24
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 ???

von Michael Drechsel - am 31.10.2014 11:34
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")



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.

von DerekT - am 31.10.2014 13:06
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.

von Michael Drechsel - am 31.10.2014 13:16
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.

von Arie - am 31.10.2014 13:20
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 ...

von Michael Drechsel - am 31.10.2014 13:28
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.

von Arie - am 31.10.2014 15:17
Hi Arie,

ok, it looks like I have to explore another (dark) site of the PC Soft WLanguage jungle :-)

von Michael Drechsel - am 31.10.2014 15:34
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.