From 5cda0d0e8485d17c578b25a830c83661c768f6fc Mon Sep 17 00:00:00 2001 From: Tomas Guisasola Date: Wed, 18 May 2005 20:52:21 +0000 Subject: [PATCH] new documentation format --- doc/examples.html | 185 +++++++++++++++++++++++++ doc/index.html | 178 ++++++++++-------------- doc/license.html | 87 +++++++++--- doc/manual.html | 339 +++++++++++++--------------------------------- 4 files changed, 415 insertions(+), 374 deletions(-) create mode 100755 doc/examples.html diff --git a/doc/examples.html b/doc/examples.html new file mode 100755 index 0000000..c6b2708 --- /dev/null +++ b/doc/examples.html @@ -0,0 +1,185 @@ + + + + LuaXMLRPC: XML-RPC interface to the Lua programming language + + + + + +
+ +
+ +
LuaXMLRPC
+
XML-RPC interface to the Lua programming language
+
+ +
+ + + +
+ + +

Examples

+ +

Client example

+ +Below is a small sample code displaying the use of the library in a +client application. + +
+require "xmlrpc.http"
+
+local ok, res = xmlrpc.http.call (
+	"http://www.oreillynet.com/meerkat/xml-rpc/server.php", 
+	"system.listMethods")
+print (ok)
+for i, v in pairs(res) do print ('\t', i, v) end
+
+ + +

Type conversion example

+ +The next example shows how to force the conversion of types from +Lua to XML-RPC. + +
+require "xmlrpc"
+
+double_array_type = xmlrpc.newArray ("double")
+double_array = xmlrpc.newTypedValue ( { 1.1, 2, 3, 4 }, double_array_type)
+
+double_array_array_type = xmlrpc.newArray (double_array_type)
+double_array_array = xmlrpc.newTypedValue (
+{
+    { 11, 12, 13, },
+    { 21, 22, 23, },
+    { 31, 32, 33, },
+}, double_array_array_type)
+
+ +The table double_array_array will be: + +
+<array>
+  <data>
+    <value>
+      <array>
+        <data>
+          <value><double>11</double></value>
+          <value><double>12</double></value>
+          <value><double>13</double></value>
+        </data>
+      </array>
+    </value>
+    <value>
+      <array>
+        <data>
+          <value><double>21</double></value>
+          <value><double>22</double></value>
+          <value><double>23</double></value>
+        </data>
+      </array>
+    </value>
+    <value>
+      <array>
+        <data>
+          <value><double>31</double></value>
+          <value><double>32</double></value>
+          <value><double>33</double></value>
+        </data>
+      </array>
+    </value>
+  </data>
+</array>
+
+ + + +

Server example

+ +Follow a small example of a server based on a cgi launcher. + +
+require "xmlrpc.cgi"
+
+local kepler_home = "http://www.keplerproject.org"
+local kepler_products = { "luasql", "lualdap", "luaexpat", "luaxmlrpc", }
+local kepler_sites = {
+    luasql = kepler_home.."/luasql",
+    lualdap = kepler_home.."/lualdap",
+    luaexpat = kepler_home.."/luaexpat",
+    luaxmlrpc = kepler_home.."/luaxmlrpc",
+}
+-- Register methods
+xmlrpc.srvMethods {
+    kepler = {
+        products = function (self) return kepler_products end,
+        site = function (self, prod) return kepler_sites[prod] end,
+    }
+}
+-- Parse POST data
+local doc = {}
+post.parsedata (doc)
+-- Decode method call
+local method, arg_table = xmlrpc.srvDecode (doc[1])
+local func = xmlrpc.dispatch (method)
+local ok, result, err = pcall (func, unpack (arg_table or {}))
+if ok then
+    result = { code = 3, message = result, }
+end
+respond (xmlrpc.srvEncode (result, not ok)
+
+ +

+Note that the package post and the function +respond should be provided by the cgi launcher. +

+ +
+ +
+ +
+

Valid XHTML 1.0!

+

+ $Id$ +

+
+ +
+ + + diff --git a/doc/index.html b/doc/index.html index 0a7d417..adb817b 100755 --- a/doc/index.html +++ b/doc/index.html @@ -1,72 +1,57 @@ - + -LuaXMLRPC: XML-RPC interface to the Lua programming language - + LuaXMLRPC: XML-RPC interface to the Lua programming language + + + - -
-
- - - - - - - - - - -
- - LuaXMLRPC logo - -
LuaXMLRPC
XML-RPC interface to the - Lua programming language -
-
+
+ +
+ +
LuaXMLRPC
+
XML-RPC interface to the Lua programming language
+
-
-overview · - current version · - download · - news · - installation · - manual · - license · - credits · - contact us -
+
+ + -
-

Contents

+
- - - -

Overview

+

Overview

LuaXMLRPC is a library to make remote procedure calls using XML-RPC. It also offers facilities @@ -80,21 +65,21 @@ needed.

LuaXMLRPC is free software and uses the same license as Lua 5.0.

- -

Current version

+ +

Status

Current version is 1.0 beta. It was developed for Lua 5.0 based on LuaExpat.

- -

Download

+ +

Download

LuaXMLRPC can be downloaded in source code from its LuaForge page. - -

What's new

+ +

History

  • [2/dec/2004] Version 1.0 beta released
  • @@ -103,32 +88,11 @@ page.

    Version 1.0 beta follows the package proposal -for Lua 5.1 (see section Installation +for Lua 5.1 (see section Installation for more details).

    - -

    Installation

    - -

    LuaXMLRPC is composed by three Lua files. -These files should be -copied to a directory named xmlrpc created in your -LUA_PATH.

    - -

    -LuaXMLRPC follows the -package proposal -for Lua 5.1, therefore this package should be "installed". -In other words, -if you are using Lua 5.0, the files compat-5.1.c and -compat-5.1.h must be used in the compilation and the file -compat-5.1.lua must be installed in the LUA_PATH. -If you are using Lua 5.1, nothing should be done. -

    - - - -

    Credits

    +

    Credits

    LuaXMLRPC was designed by Roberto Ierusalimschy, André @@ -143,8 +107,8 @@ LuaXMLRPC development was sponsored by and FINEP.

    - -

    Contact us

    + +

    Contact us

    For more information please @@ -152,20 +116,18 @@ For more information please Comments are welcome!

    -
    -overview · -current version · -download · -news · -installation · -manual · -license · -credits · -contact us -
    +
+ +
+ +
+

Valid XHTML 1.0!

+

+ $Id$ +

+
+ +
-
-$Id$ - - + diff --git a/doc/license.html b/doc/license.html index 84614f3..eda44bd 100755 --- a/doc/license.html +++ b/doc/license.html @@ -1,13 +1,59 @@ - + - -LuaXMLRPC: license + LuaXMLRPC: XML-RPC interface to the Lua programming language + + - -
-

License

+ +
+ +
+ +
LuaXMLRPC
+
XML-RPC interface to the Lua programming language
+
+ +
+ + + +
+ +

License

+ +

LuaXMLRPC is free software: it can be used for both academic and commercial purposes at absolutely no cost. There are no royalties or GNU-like "copyleft" restrictions. LuaXMLRPC qualifies as software. Its licenses are compatible with GPL. LuaXMLRPC is not in the public domain and The Kepler Project keep its copyright. The legal details are below. - +

The spirit of the license is that you are free to use LuaXMLRPC for any purpose at no cost without having to ask us. The only @@ -28,13 +74,10 @@ in your product or its documentation.

Ierusalimschy, André Carregal and Tomás Guisasola. The implementation is not derived from licensed software.

+

- -

- -
Copyright © 2003-2004 The Kepler Project. - +

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without @@ -55,12 +98,18 @@ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

-

- -

+
+ +
+ +
+

Valid XHTML 1.0!

+

+ $Id$ +

+
+ +
-
-$Id$ - - + diff --git a/doc/manual.html b/doc/manual.html index 2bc70b5..464b8f7 100755 --- a/doc/manual.html +++ b/doc/manual.html @@ -1,46 +1,58 @@ - + - -LuaXMLRPC: XML-RPC interface to the Lua programming -language - + LuaXMLRPC: XML-RPC interface to the Lua programming language + + - -
-
- - - - + - - - +
+ +
+ +
LuaXMLRPC
+
XML-RPC interface to the Lua programming language
+
-
- - -
-"LuaXMLRPC
LuaXMLRPC Reference Manual -
XML-RPC interface to the Lua programming language
-
+
+ + -
home · introduction · data types · basicclient · server · examplesrelated docs
+
-
- -

Introduction

+

Introduction

LuaXMLRPC is a Lua library to build XML-RPC clients and @@ -62,19 +74,38 @@ structures.

LuaXMLRPC is based on LuaExpat and on Lua 5.0.
+href="http://www.lua.org">Lua 5.0. The abstraction layer over HTTP depends on LuaSocket 2.0.
-

+"http://www.tecgraf.puc-rio.br/luasocket">LuaSocket 2.0. +

-

Data types

+

Installation

+ +

LuaXMLRPC is composed by three Lua files. +These files should be +copied to a directory named xmlrpc created in your +LUA_PATH.

+ +

+LuaXMLRPC follows the +package proposal +for Lua 5.1, therefore this package should be "installed". +In other words, +if you are using Lua 5.0, the files compat-5.1.c and +compat-5.1.h must be used in the compilation and the file +compat-5.1.lua must be installed in the LUA_PATH. +If you are using Lua 5.1, nothing should be done. +

+ + + +

Data types

XML-RPC elements are usually represented by the simplest correspondent Lua object. When the correspondance is not obvious, a -Lua table is used with a field specifying the element.

+Lua table is used with a field specifying the element.

-

From XML-RPC to Lua

+

From XML-RPC to Lua

When converting from XML-RPC element to a Lua object, a table with a field tag is used. The child elements are @@ -124,9 +155,8 @@ arrray - -

From Lua to XML-RPC

+

From Lua to XML-RPC

A conversion from a Lua object to an XML-RPC can be made automatically or explicitly. The automatic conversion rules @@ -170,6 +200,7 @@ are:

+

In case of a table that has numeric keys, the resulting struct will have the string representation of these numbers as keys (e.g. "1" instead of 1). The library tries to @@ -178,9 +209,9 @@ them to floating point numbers. - +

-

Basic support

+

Basic support

The file xmlrpc.lua implements all basic support for encoding and decoding XML-RPC messages and for transforming @@ -261,9 +292,8 @@ the object is encapsulated into that function so that the call will be turned into a real method call. - -

Client side

+

Client side

The file xmlrpc.http.lua implements a simple stand-alone client based on faultString and the - -

Server side

+

Server side

The distribution also offers a simple XML-RPC server implemented over a CGI launcher. This launcher just have to offer a way to @@ -308,213 +337,29 @@ responses.

The main goal of this file is to give a starting point for other real implementations.

- -

Examples

- - - -

Client example

- -Below is a small sample code displaying the use of the library in a -client application. - -
-
-require "xmlrpc.http"
-
-local ok, res = xmlrpc.http.call ("http://www.oreillynet.com/meerkat/xml-rpc/server.php", "system.listMethods")
-print (ok)
-for i, v in pairs(res) do print ('\t', i, v) end
-
-
- - - -

Type conversion example

- -The next example shows how to force the conversion of types from -Lua to XML-RPC. - -
-
-require "xmlrpc"
-
-double_array_type = xmlrpc.newArray ("double")
-double_array = xmlrpc.newTypedValue ( { 1.1, 2, 3, 4 }, double_array_type)
-
-double_array_array_type = xmlrpc.newArray (double_array_type)
-double_array_array = xmlrpc.newTypedValue (
-{
-    { 11, 12, 13, },
-    { 21, 22, 23, },
-    { 31, 32, 33, },
-}, double_array_array_type)
-
-
- -The table double_array_array will be: - -
-
-<array>
-  <data>
-    <value>
-      <array>
-        <data>
-          <value><double>11</double></value>
-          <value><double>12</double></value>
-          <value><double>13</double></value>
-        </data>
-      </array>
-    </value>
-    <value>
-      <array>
-        <data>
-          <value><double>21</double></value>
-          <value><double>22</double></value>
-          <value><double>23</double></value>
-        </data>
-      </array>
-    </value>
-    <value>
-      <array>
-        <data>
-          <value><double>31</double></value>
-          <value><double>32</double></value>
-          <value><double>33</double></value>
-        </data>
-      </array>
-    </value>
-  </data>
-</array>
-
-
- - - -

Server example

- -Follow a small example of a server based on a cgi launcher. - -
-
-require "xmlrpc.cgi"
-
-local kepler_home = "http://www.keplerproject.org"
-local kepler_products = { "luasql", "lualdap", "luaexpat", "luaxmlrpc", }
-local kepler_sites = {
-    luasql = kepler_home.."/luasql",
-    lualdap = kepler_home.."/lualdap",
-    luaexpat = kepler_home.."/luaexpat",
-    luaxmlrpc = kepler_home.."/luaxmlrpc",
-}
--- Register methods
-xmlrpc.srvMethods {
-    kepler = {
-        products = function (self) return kepler_products end,
-        site = function (self, prod) return kepler_sites[prod] end,
-    }
-}
--- Parse POST data
-local doc = {}
-post.parsedata (doc)
--- Decode method call
-local method, arg_table = xmlrpc.srvDecode (doc[1])
-local func = xmlrpc.dispatch (method)
-local ok, result, err = pcall (func, unpack (arg_table or {}))
-if ok then
-    result = { code = 3, message = result, }
-end
-respond (xmlrpc.srvEncode (result, not ok)
-
-
- -Note that the package post and the function -respond should be provided by the cgi launcher. - -

Related documentation

+

References

+

Here is a list of related documentation: +

- +
-

Contents

+
- - -
-
- - -
home · introduction · data types · basicclient · server · examplesrelated docs
- -
-$Id$ - - +