LuaSOAP logo
LuaSOAP Reference Manual
SOAP interface to the Lua programming language

home · introduction · soap elements · basic · client · examples · related docs


Introduction

LuaSOAP is a Lua library to ease the use of SOAP. It enables a Lua program to:

LuaSOAP provides a very simple API and an abstraction layer over XML avoiding manipulation of string representation of data structures.

LuaSOAP is based on LuaExpat and on Lua 5.0.
The abstraction layer over HTTP depends on LuaSocket 2.0.

SOAP elements

SOAP elements are always represented by Lua tables except strings. A SOAP element is a table of the form defined by the Lua Object Model from the LuaExpat library. The table has the following characteristics:

Attributes

The special field attr is a Lua table that stores the SOAP element's attributes as pairs <key>=<value>. To assure an order (if necessary), the sequence of keys should be placed at the array-part of the table.

Basic support

The file soap.lua implements all basic support for encoding and decoding SOAP messages. There are two functions:

Client side

The file soap.http.lua implements a simple stand-alone client based on LuaSocket 2.0. The following function is provided:

Examples

Client example

Below is a small sample code displaying the use of the library in a client application.
require "soap/http"
local ns, meth, ent = soap.http.call ("http://soap.4s4c.com/ssss4c/soap.asp", "http://simon.fell.com/calc", "doubler", {
		{
			tag = "nums",
			attr = {
				["xmlns:SOAP-ENC"] = "http://schemas.xmlsoap.org/soap/encoding/",
				["SOAP-ENC:arrayType"] = "xsd:int[5]",
			},
			{ tag = "number", 10 },
			{ tag = "number", 20 },
			{ tag = "number", 30 },
			{ tag = "number", 50 },
			{ tag = "number", 100 },
		},
	})
print("namespace = ", ns, "element name = ", meth)
for i, elem in ipairs (ent[1]) do print (elem[1]) end

Related documentation

Here is a list of related documentation:

Contents

home · introduction · soap elements · basic · client · examples · related docs


$Id: manual.html,v 1.3 2004/03/29 11:15:22 tomas Exp $