Hi,
I’m posting data to a WCF service written in ASP.Net and have run into a problem when trying to post a json string. It works fine if I post this string into the service when NOT using Corona.
My LUA code is…
local postContents = {}; postContents.userId = 1; postContents.title ="My Title"; postContents.agreedToTerms = 1; local uploadContentsJson = json.encode (postContents); -- Set correct content type local headers = { ["Content-Type"] = "application/json", ["Accept-Language"] = "en-US", } params.headers = headers -- And the rest of the params params.body = "uploadContentsJson="..uploadContentsJson; -- json string params.progress = "upload"; params.timeout = 60; -- (seconds) - default is 30 local url = "https://myservice.mydomain.com/services/service.svc/Upload"; requestId = network.request( url, "POST", fileUploadListener, params);
So…
-
if I remove the content-type from the headers or change it or just remove the headers altogether, then the post reaches the online .Net service but I get a .Net error which says the content type is expected to be XML or Json.
-
when I put that line back in, my fileUploadListener event listener fires, and reaches its “ENDED” phase, but nothing is returned.
-
if the equivalent json string is submitted to the service using other methods than Corona, the service runs correctly.
Any help much appreciated - I’m at my wits end!
Thanks,
Ian