File: manual.html

package info (click to toggle)
lua-soap 1.0b-5
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 112 kB
  • ctags: 38
  • sloc: sh: 66; makefile: 34
file content (232 lines) | stat: -rw-r--r-- 6,838 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<title>LuaSOAP: SOAP interface to the Lua programming
language</title>
<style type="text/css">
ul { list-style-type: disc };
</style>
</head>
<body bgcolor="#FFFFFF">
<hr>
<center>
<table border="0" cellspacing="2" cellpadding="2">
<tr>
<td align="center"><a href=
"http://www.keplerproject.org/luaxmlrpc"><img border="0" alt=
"LuaSOAP logo" src="luasoap.png"></a> </td>
</tr>

<tr>
<td align="center"><big><b>LuaSOAP Reference Manual</b></big> </td>
</tr>

<tr>
<td align="center" valign="top">SOAP interface to the <a href=
"http://www.lua.org">Lua</a> programming language</td>
</tr>
</table>
</center>

<center><small><a href="index.html">home</a> &middot; <a href=
"#introduction">introduction</a> &middot; <a href=
"#soap_elements">soap elements</a> &middot; <a href=
"#basic">basic</a> &middot; <a href="#client">client</a> &middot;
<a href="#examples">examples</a> &middot; <a href=
"#related_docs">related docs</a></small></center>

<hr>
<a name="introduction"></a> 

<h2>Introduction</h2>

<p>LuaSOAP is a <a href="http://www.lua.org">Lua</a> library to
ease the use of <a href=
"http://www.w3.org/TR/2003/REC-soap12-part0-20030624/">SOAP</a>. It
enables a Lua program to:</p>

<ul>
<li>Encode and decode SOAP messages without having to deal directly
with XML code</li>
</ul>

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

<p>LuaSOAP is based on <a href=
"http://www.keplerproject.org/luaexpat">LuaExpat</a> and on <a
href="http://www.lua.org">Lua 5.0</a>.<br>
 The abstraction layer over HTTP depends on <a href=
"http://www.tecgraf.puc-rio.br/luasocket">LuaSocket 2.0</a>.<br>
 <a name="soap_elements"></a></p>

<h2>SOAP elements</h2>

<p>SOAP elements are always represented by Lua tables except
strings. A SOAP element is a table of the form defined by the <a
href="http://www.keplerproject.org/luaexpat/lom.html">Lua Object
Model</a> from the <a href=
"http://www.keplerproject.org/luaexpat">LuaExpat</a> library. The
table has the following characteristics:</p>

<ul>
<li>a special field called <code>tag</code> with the element's
name;</li>

<li>a special optional field called <code>attr</code> with the
element's attributes (see next section);</li>

<li>the element's children are stored at the <em>array-part</em> of
the table. A child could be an ordinary string or SOAP element (a
Lua table following these same rules).</li>
</ul>

<h4>Attributes</h4>

<p>The special field <code>attr</code> is a Lua table that stores
the SOAP element's attributes as pairs
<em>&lt;key&gt;=&lt;value&gt;</em>. To assure an order (if
necessary), the sequence of <em>key</em>s should be placed at the
<em>array-part</em> of the table. <a name="basic"></a></p>

<h2>Basic support</h2>

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

<ul>
<li style="list-style: none"><a name="encode"></a></li>

<li><b><code>encode (namespace, element_name, entries, headers*)
=&gt; envelope</code></b><br>
 Builds a SOAP document containing a <code>SOAP-Envelope</code>
element. It receives two strings with the namespace (an URI) and
the SOAP-element's name and, as the third argument, a table with
zero or more <a href="#soap_elements">SOAP elements</a>. An
optional fourth argument can be used to generate the SOAP Header
(it must be a <a href="#soap_elements">SOAP element</a> too). The
result is a string containing the SOAP document. <a name=
"decode"></a></li>

<li><b><code>decode (method_response) =&gt; namespace,
element_name, elements</code></b><br>
 Disassembles a SOAP document into Lua objects. It receives a
string containing the SOAP document. The result are the namespace
(string), the SOAP-element's name (string) and a table with the
contents of the SOAP Body. Each element of this table can be a
string or a <a href="#soap_elements">SOAP element</a>.</li>
</ul>

<a name="client"></a> 

<h2>Client side</h2>

<p>The file <code>soap.http.lua</code> implements a simple
stand-alone client based on <a href=
"http://www.tecgraf.puc-rio.br/luasocket">LuaSocket 2.0</a>. The
following function is provided:</p>

<ul>
<li style="list-style: none"><a name="call"></a></li>

<li><b><code>call (url, namespace, element_name, entries,
headers*)</code></b><br>
 It encapsulates the call of <code>encode</code> and
<code>decode</code> over a connection to an HTTP server. The result
is the same as <a href="#decode">decode</a> function: the namespace
(string), the SOAP-element's name (string) and a table with the
contents of the SOAP Body.</li>
</ul>

<a name="examples"></a> 

<h2>Examples</h2>

<a name="client_example"></a> 

<h3>Client example</h3>

Below is a small sample code displaying the use of the library in a
client application. 

<blockquote>
<pre>
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
</pre>
</blockquote>

<a name="related_docs"></a> 

<h2>Related documentation</h2>

Here is a list of related documentation: 

<ul>
<li><a href=
"http://www.w3.org/TR/2003/REC-soap12-part0-20030624/">http://www.w3.org/TR/2003/REC-soap12-part0-20030624/</a></li>
</ul>

<a name="contents"></a> 

<h2>Contents</h2>

<ul>
<li><a href="#introduction">Introduction</a></li>

<li><a href="#soap_elements">SOAP elements</a></li>

<li><a href="#basic">Basic support</a> 

<ul>
<li><a href="#encode">encode</a></li>

<li><a href="#decode">decode</a></li>
</ul>
</li>

<li><a href="#client">Client side</a> 

<ul>
<li><a href="#call">call</a></li>
</ul>
</li>

<li><a href="#examples">Examples</a></li>

<li><a href="#related_docs">Related documentation</a></li>
</ul>

<br>
<br>
 

<center><small><a href="index.html">home</a> &middot; <a href=
"#introduction">introduction</a> &middot; <a href=
"#soap_elements">soap elements</a> &middot; <a href=
"#basic">basic</a> &middot; <a href="#client">client</a> &middot;
<a href="#examples">examples</a> &middot; <a href=
"#related_docs">related docs</a></small></center>

<hr>
<small>$Id: manual.html,v 1.5 2004/12/02 15:02:55 tomas Exp $</small>
</body>
</html>