Representing Italy, Gabriele had his first experience with computers when he was 6 and his father bought a Commodore 64. He was fascinated by it and at about 10 he began learning Basic; at about 13 he was programming in machine language; and at 14 he bought an Amiga 500 and learned C and M68k assembly. In the successive years he learned a number of languages, ranging from Pascal to C++, passing through AmigaDOS scripts and ARexx; he wrote a number of (unreleased) programs in AmigaE which became his favourite language. He learned about REBOL while he was studying Forth, he downloaded REBOL 1.0.2 and in a few weeks he was addicted to it. He has actively participated in the REBOL community since then, and has developed a number of commercial and non-commercial REBOL applications.
Implementing a Lightweight Network Service in less than an hour
REBOL/Services, also known as LNS, brings the revolution in network services. It is possible to design and implement powerful and secure network services with minimal effort. Gabriele will show how to build complete services in less than an hour.
- Download video (BitTorrent)
- Download video (HTTP) (right click and Save As)
What is REBOL/Services?
REBOL/Services is a client/server, request-response system to easily create secure lightweight network services.
It is secure because it was designed with security in mind from the ground up, and always uses encryption.
It is lightweight because it is small and does not have dependencies, except for REBOL itself.
Think of it as the ARexx of the X Internet.
What is REBOL/Services? (2)
It is not a network protocol, in the strict sense. REBOL/Services does not define how packets (requests, or responses) get from the client to the server and viceversa. In principle, any means can be used to transport packets between the client and the server.
It does, however, define how a packet is formed. It also supports plug-in handlers to transport packets; example available transports are HTTP and TCP. It is easy to add other transports (EMail, UDP, … ).
Overview
REBOL/Services provides an API both for clients and for servers.
It also provides example transport handlers.
You don’t need to worry about the details, such as encryption, security, authentication and so on. You just concentrate on the development of the service itself.
A service is basically a command interpreter, using a REBOL dialect. This means that you just use PARSE to interpret your commands on the server.
Overview, client
On the client side, it can be as easy as:
result: do-service my-service-url [some-command]
Example:
>> result: do-service tcp://localhost:8000 [info]
== [
done [reply seq 1 service "Generic REBOL Service" commands 1 time 0:00]
ok [info title "Generic REBOL Service" summar...
>> print mold result
[
done [reply seq 1 service "Generic REBOL Service" commands 1 time 0:00]
ok [info title "Generic REBOL Service" summary "This is a default REBOL service." version 1.0.0]
]
Overview, server
On the server side, it is usually as easy as:
service-port: start-service port-spec
Example:
service-port: start-service tcp://:8000
or:
start-service 'cgi
Overview, server (2)
To create your own service, you just need to create a file in the services directory, for example my-service.r. The contents of the file is something like:
REBOL [
; optional rebol header...
]
name: 'my-service
title: "My Service"
description: "Implements my service."
language: 'en
commands: [
'echo #doc [
en "Echo whatever values were passed"
it "Ripete qualunque valore inviato"
]
result: to end
|
; other commands...
]
Then, start the server with:
service-port: start-service/options port-spec [my-service]
Creating a service in less than a hour
As you have seen, creating your own service just means writing the actual code of the service; everything else is trivial; using it on the client side is even easier.
So… let’s just try to write a file service!