Hi Walter

        I am sorry for the so late response, but I was very busy
the last few weeks.

I've been looking at server.lua, and of course there are no instances of
SOAP server routines, the user has to provide them. But could you outline
the steps for adding a service routine?
        I think that code doesn't make much sense to non-CGILua
developers...  I will try to explain how it is supposed to work.
        The script server.lua is a module to help implement a
script which should work as a server able to dispatch requests to
a set of objects.  Thus, the objects need to be registered in the
server's catalog via soap.server.export function, which receives
a description of the service, such as:

-- Untested code !!!
local matricula2URL_descr = {
    name = "matricula2URL",
    method = matricula2URL,
    message = { name = "matricula2URL",
                { name = "matricula", occurrence = 1, type = "string", },
    },
    response = { name = "matricula2URLResponse",
                { name = "URL", occurrence = 1, type = "string", },
    },
}
soap.server.export(matricula2URL_descr)

        After doing that for every object, the server-script might
call handle_request():

soap.server.handle_request(cgilua.POST[1], 
cgilua.servervariable("QUERY_STRING"))

        This function will try to dispatch the request to the
corresponding object.

Also, I'm puzzled by your earlier comment that,

There is no automatically-generated WSDL.

Almost half of the source code seems to be about that, such as the routine:
        Well, the size of the code that builds SOAP means nothing :-(

function generate_wsdl().
        I use this code, but I will not recommend it to anyone,
since there are no tests.  Anyway, if you are interested, I can
try to explain how it works.
        The function soap.server.register_service_info just registers
information needed to respond to WSDL and discovery requests (the
dispatch might be done by handle_request also).  A simple example:

-- Untested code !!!
local server_name = cgilua.servervariable("SERVER_NAME")
local path = string.format("http://%s/my/URL/";, server_name)
local script = path.."soap-server-script.lua" -- the name of this script!

local disco = string.format([=[<?xml version="1.0" encoding="iso-8859-1" ?>
<discovery
    xmlns:xsd="http://www.w3.org/2001/XMLSchema";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xmlns="http://schemas.xmlsoap.org/disco/";>
<contractRef
    ref="%s?wsdl"
    docRef="%s"
    xmlns="http://schemas.xmlsoap.org/disco/scl/"; />
<soap
    address="%s"
    xmlns:q1="Matricula2URLSoapBind"
    binding="q1:Matricula2URLSoapBind"
    xmlns="http://schemas.xmlsoap.org/disco/soap/"; />
</discovery>]=], script, script, script)

server.register_service_info("matricula2URL", path, script, nil, disco)

        The above code should be put before the handle_request call.
        Note that we developed this functions to our needs, but we
hadn't time to test it properly. I can't even say whether it violates the SOAP specification or not, so please, use it at your own risk.
Anyway, it could be useful.
        Feel free to ask me anything about that.

        Regards,
                Tomás
_______________________________________________
Kepler-Project mailing list
[email protected]
http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project
http://www.keplerproject.org/

Reply via email to