Ada Programming/Libraries/Web/AWS

AWS, the Ada Web Server, is a complete framework to develop Web based applications. The main part of AWS is the embedded web server. This small, yet powerful, Web server can be embedded into your application, so it will be able to talk with a standard Web browser. Around this Web server, a lot of services have been developed.

AWS supports SOAP Web Services and the REST architecture.

Hello World
The famous Hello World demo for AWS, a complete Web server that will display "Hello world!" for every request made to localhost on port 8080.

AWS.Default; AWS.Response; AWS.Server; AWS.Status; Hello_World WS : AWS.Server.HTTP; HW_CB (Request : AWS.Status.Data) AWS.Response.Data AWS.Response.Build ("text/html", "Hello world !"); HW_CB; AWS.Server.Start (WS, "Hello World", Callback => HW_CB'); 60.0;   AWS.Server.Shutdown (WS); Hello_World;

Setting server configuration and waiting for an event
It is possible to pass configuration parameters for the server using a record. It is also possible to use a built-in procedure on AWS to wait for an event.

callbacks.adb

Callbacks HW_CB (Request : AWS.Status.Data) AWS.Response.Data AWS.Response.Build ("text/html", "Hello world !"); HW_CB; Callbacks;

callbacks.ads

AWS.Status; AWS.Response; Callbacks HW_CB (Request : AWS.Status.Data) AWS.Response.Data; Callbacks;

main.adb

AWS.Config.Set; AWS.Server; Main AWS; Host : String := ; Port :        := ; Web_Server : Server.HTTP; Web_Config : Config.Object; Config.Set.Server_Host (Web_Config, Host); Config.Set.Server_Port (Web_Config, Port); Server.Start (Web_Server => Web_Server,                 Callback => Callbacks.HW_CB',                  Config => Web_Config); Server.Wait (Server.Q_Key_Pressed); Server.Shutdown (Web_Server); Main;

REST
Interface with bitcoind JSON-RPC.

bitcoin.adb

AWS.Client; AWS.Headers; AWS.Headers.Set; AWS.Response; Bitcoin Get_Wallet_Info AWS.Response.Data hdrs : AWS.Headers.List := AWS.Headers.Empty_List; AWS.Headers.Set.Add(hdrs,, ); AWS.Client.Post(URL =>,                      Data => ,                       User => ,                       Pwd => ,                       Headers => hdrs); Get_Wallet_Info; Bitcoin;

Create the bitcoin.conf file by opening Bitcoin Core and clicking on the corresponding button on the options window. The following is an example configuration file. Then reopen bitcoin-qt or start the bitcoind daemon to start the server. The bitcoin-cli program and the testnet network can be used for testing RPC commands.

bitcoin.conf

server=1 rpcuser=USERNAME rpcpassword=PASSWORD
 * 1) Expose the RPC/JSON API

Wikipedia

 * Web application
 * Web services
 * SOAP

Wikibook

 * Ada Programming
 * Ada Programming/Libraries (Other Language Libraries)