On Mon, Nov 1, 2010 at 3:13 PM, Thijs Koerselman
<thijskoersel...@gmail.com> wrote:

> Now when I'm trying to call a service I get the following error in Orbit:
>
>  Xavante Error: variable 'cookies' is not declared
>  thread: 0x1001a0600
>  tcp{client}: 0x10082d428
>

The cookies error appeared to come from trying to include the penlight
module (??). I wanted to use pretty.write to investigate the data.
Including just the pretty submodule solved the issue.

Now that I was able to have a good look at the data in the web object
i managed to adapt my code to work with Orbit.

I basically had to change my handle_request() method, which expected a
wsapi request object:

function handle_request(request)
        local method = request.method
        local postdata = request.POST.post_data
        local querystring = request.query_string

... to parse the data from the web object instead:

function handle_webobject(web)
        local method = web.vars.REQUEST_METHOD
        local postdata = web.POST.post_data
        local querystring = web.vars.QUERY_STRING
        
It would probably be better to just pass those 3 variables separately
instead of the objects, since the rest of the method remains the same.

Instead of returning wsapi response:finish(), I returned just the body
of my wsapi response object, which seems to work fine. Is this really
the correct way? I wonder since the headers and everything else gets
lost this way it seems...

Anyway this is the final relevant bit of my Orbit app:

function handleServiceCall(web, name)
        local ws_response = soap.wsserver.handle_webobject(web)
        ws_response:finish()
        return ws_response.body
end

-- export / register our soap methods
soap.wsserver.export(helloDescription)
soap.wsserver.export(helloNumberDescription)
soap.wsserver.export(helloStringDescription)
        
soap_orbit:dispatch_post(handleServiceCall, "/services")


Thijs

_______________________________________________
Kepler-Project mailing list
Kepler-Project@lists.luaforge.net
http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project
http://www.keplerproject.org/

Reply via email to