Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
8
Erster Beitrag:
vor 11 Monaten, 3 Wochen
Letzter Beitrag:
vor 11 Monaten, 3 Wochen
Beteiligte Autoren:
HIS 21, Arie, Fabrice Harari, Peter Holemans

[WB18 - WM19] Send data via HTTP

Startbeitrag von HIS 21 am 01.12.2016 09:32

Good Morning,

I have to send an http request from a WinDev Mobile application to a WebDev application.
The request contains:

a list of textual data records
a list of images linked to each record

How to send the request from WinDev Mobile and, above all, how to retrieve data from a WebDev page?

I could use functions like HTTPAddParameter(), HTTPAddFile() and HTTPSendForm() from the mobile application but the problem is that I have to read this request in WebDev.

I'm reading about PageParameter(paramBuffer) but doesn't seems the right way to do what I want.

What's the best way?

Antworten:

Hi,

I'm using httprequest() to send the request to a WB page. i.e.
The request can be anything that's up to you, like an simple string or a tab-separated string or a XML string.
There I use PageParameter() to analyze the info, build the result and finally use StringDisplay() to return that to WM.

Seen from WM it's more or less like running a procedure or function on the webserver.
No htttpaddparameter or httpsendform needed.

A simple example would be to send "GetProducts" and return the result as
1 TAB Volvo CR
2 TAB BMW CR
3 TAB Mercedes
etc

von Arie - am 01.12.2016 10:00
Hi Arie,

thanks alot for your answer, but what about the photos? How can I sent photo to WebDev page?

von HIS 21 - am 01.12.2016 10:15
Hi HIS21,

You can encode these in base64 like you do with web services and decode it again on the WebDev side.
Functions Crypt/Uncrypt in WX.

Cheers,

Peter Holemans

von Peter Holemans - am 01.12.2016 10:19
Hi Perter,

thanks alot, I will try. Do you have an example to show me?

von HIS 21 - am 01.12.2016 10:22
Hi HIS21,

I use fLoadBuffer to read the image data from the file on the mobile device and send it to the server with the "application/octet-stream" as the type of message.

For some reason I never did the base64 conversion (I think because I didn't know about it years ago....). Maybe this parameter will instruct WM/WB to do this at a lower level? I can't answer that but I send 100000+ photos without any error

I even send the photos in chunks of 250Kb to be able to show some progress on the mobile device. Server side these chunks are simply put to one piece and saved with fSaveBuffer

von Arie - am 01.12.2016 10:35
Thancks Aire,

have you got some spinnet of code to hcare with me?

von HIS 21 - am 01.12.2016 10:42
Hi

if you want an example, or even the full system already working and ready for use, you can check out wxreplication on my web site.
It's open source, and it's able of doing a full or partial replication using just that system (and encrypting the data on top of it)

Best regards

von Fabrice Harari - am 01.12.2016 11:02
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.