Network call crashing Simulator when trying to pass Params

I am trying to pass some XML code for an xml-rpc call, using the network functions. I have it working without params. But if I try to setup the header and body and then put it into a params table to pass, Corona crashes, and I get the following error:

Assertion failed: ((((t)->tt) == 5)), function lua_next, file /Users/ansca/.hudson/jobs/Main-DMG/workspace/platform/mac/…/…/external/lua-5.1.3/src/lapi.c, line 976.

Here is the relevant code I have so far.

local xmlbody = '<?xml version="1.0"?>' xmlbody = xmlbody.."<methodcall>"<br> xmlbody = xmlbody.."<methodname>system.connect</methodname>"<br> --xmlbody = xmlbody.."<methodcall>"<br> xmlbody = xmlbody.."</methodcall>"<br><br> local xmlheaders = {}<br> <br> xmlheaders["Content-Type"] = "text/xml"<br> xmlheaders["Accept-Language"] = "en-US"<br> xmlheaders["Content-Length"] = #xmlbody<br> xmlheaders.body = xmlbody<br> <br> local params = {}<br> <br> params.headers = xmlheaders<br> params.body = xmlbody<br> <br> local function pullTest( event )<br> if ( event.isError ) then<br> print ("A Network Error Happened!")<br> else <br> print ("RESPONSE: "..event.response)<br> end<br> end<br> <br> network.request("http://www.example.com/services/xmlrpc", "POST", pullTest, params)

If I comment out all of the params variable code, it works fine, so it is something I am doing with those three lines dealing with the params variable.

Thanks for any help you can provide. [import]uid: 41116 topic_id: 7702 reply_id: 307702[/import]

So does anyone know the proper way to pass parameters with a network call? What am I doing wrong above? Why is it crashing the simulator?

Thanks. [import]uid: 41116 topic_id: 7702 reply_id: 27395[/import]

Ok, I figured it out.

Doing something like this fixed it.

xmlheaders[“Content-type”] = “text/xml”
xmlheaders[“Content-length”] = #xmlbody
xmlheaders.body = xmlbody

The documentation is a little confusing. Header and Body are in the same table, but there is no containing “header” table within this table. Headers are top level. [import]uid: 41116 topic_id: 7702 reply_id: 27496[/import]

Hi Bainem,

I don’t see the difference between the code you wrote in first and last post (which fixed it).

I am running into same crash. Is it possible to copy paste the full working code snippet?

Thanks [import]uid: 41983 topic_id: 7702 reply_id: 29146[/import]