On Fri, Sep 24, 2010 at 12:12 PM, Thijs Koerselman
<[email protected]> wrote:
>
> I don't think I have enough experience or knowledge about LuaSOAP to
> be of much help, but I will start investigating the LuaSOAP/Orbit
> marriage next week probably. I'll let you know if I make any progress,
> and I would appreciate it if you do the same.
>
I couldn't resist so I started already and believe I got pretty far
but now I'm stuck. Here's what I have so far:
- change soap.server.handle_request to return the response and header
instead of calling respond() which formats things the cgilua way. So
the last bit of handle_request() looks like this:
local ok, result = callfunc(func, namespace, arg_table)
return result, header
Then below is my hello world soap server script using wsapi:
#!/usr/bin/env wsapi.cgi
require 'luarocks.loader'
require "wsapi.response"
-- load edited version of soap.server
local soap = {}
soap.server = require "xsoap.xserver"
module("hello_soap_wsapi", package.seeall)
function hello(namespace, args)
return {tag = "HelloResponse" }
end
local helloDescription = {
name = "hello",
method = hello,
message = { name="hello"},
response = { name="HelloResponse"},
}
function run(wsapi_env)
-- export / register our soap methods
soap.server.export(helloDescription)
-- handle the request passing POST and GET data to soap.server
local res_content, xml_header =
soap.server.handle_request(wsapi_env.POST, wsapi_env.GET)
-- create a response helper object
local res = wsapi.response.new()
-- soap 1.1 is text/xml
res.headers["Content-type"] = "text/xml"
-- ?? taken from soap.server.respond()
res.headers["Connection"] = "close"
res.status = 200
res:write(xml_header) -- xml encoding tag
res:write(res_content)
-- finish() returns status, headers, body
-- also calculates and sets Content-length header
return res:finish()
end
return _M
But then I keep running into this error:
lua: ../luamodules/xsoap/xclient.lua:91: Error on request: 1
<html>
<head><title>WSAPI Error in Application</title></head>
<body>
<p>There was an error in the specified application.
The full error message follows:</p>
<pre>
/usr/local/share/lua/5.1//wsapi/ringer.lua:123: attempt to index
upvalue 'state' (a nil value)
stack traceback:
/usr/local/share/lua/5.1//wsapi/ringer.lua:123: in function 'app'
/usr/local/share/lua/5.1//wsapi/common.lua:548: in function
'load_wsapi_isolated'
/usr/local/share/lua/5.1//wsapi/common.lua:525: in function
</usr/local/share/lua/5.1//wsapi/common.lua:518>
(tail call): ?
(tail call): ?
stack traceback:
/usr/local/share/lua/5.1//coxpcall.lua:24: in function
</usr/local/share/lua/5.1//coxpcall.lua:22>
(tail call): ?
(tail call): ?
(tail call): ?
/usr/local/share/lua/5.1//wsapi/xavante.lua:129: in function
</usr/local/share/lua/5.1//wsapi/xavante.lua:92>
(tail call): ?
(tail call): ?
(tail call): ?
/usr/local/share/lua/5.1//xavante/httpd.lua:58: in function
</usr/local/share/lua/5.1//xavante/httpd.lua:36>
</pre>
</body>
</html>
Does anyone have a clue why the state object could be nil in
wsapi.ringer? Here's the code up until the offending state:close() at
line 123:
-- Returns a WSAPI application that runs the provided WSAPI application
-- in an isolated Lua environment
function new(app_name, bootstrap, is_file)
local data = { created_at = os.time() }
setmetatable(data, { __index = _G })
local state = rings.new(data)
assert(state:dostring(init, app_name, bootstrap, is_file))
local error = function (msg)
data.status, data.headers, data.env = nil
error(msg)
end
return function (wsapi_env)
if wsapi_env == "close" then
state:close()
I'm completely in the dark about this so any pointers would be helpful.
Also I can't seem to figure out how to write or locate an error log
with this wsapi/xavante thing. I also tried lualogging but that didn't
seem to work for either some reason. Where can I find the xavante
error log or generate one?
Thijs
_______________________________________________
Kepler-Project mailing list
[email protected]
http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project
http://www.keplerproject.org/