Article Preview
Buy Now
FEATURE
Inside HandleSpecialURL
How to use Web Edition for your own REST API
Issue: 12.5 (September/October 2014)
Author: Christian Schmitz
Author Bio: Christian Schmitz is the creator of the Monkeybread Software Xojo/Real Studio Plugins.
Article Description: No description available.
Article Length (in bytes): 10,073
Starting Page Number: 35
Article Number: 12506
Resource File(s):
12506project.zip Updated: 2014-09-02 10:53:17
Related Web Link(s):
http://127.0.0.1
http://127.0.0.1
http://www.xojo.com/blog/en/2014/08/handlespecialurl-changes-in-2014r21.php
Excerpt of article text...
With the web edition framework you get a full web server for handling web requests for free. You can use it with the
HandleSpecialURL
event in the app class. In our example, we use this event to handle requests with a REST-like API. We use JSON to package data for the transfer. This is different from a SOAP web service which uses XML for transfer.Client
First, the client. We take a new project and name it
client
. On the main window we place alistbox
and acanvas
. Thelistbox
will show the list of image file names and thecanvas
shows the image (see Figure 1).We add an
HTTPSocket
to the window and name itsock
. Now in theopen
event of the window you can start a query to the server to get the list of files:
sock.Get "http://127.0.0.1:8080/api/images"
...End of Excerpt. Please purchase the magazine to read the full article.