SetRequestContent from iOS

I’m struggling.

I was testing an iOS + XOJO Web app solution with the intention of moving it to Xojo cloud.
I was using HandleSpecialURL, but there are difference between running a web app from the desktop and Xojo cloud.

I was passing strings like …/index.cgi/special/MyPath?value1=xyz to just sending the path and trying to set all the parameters for the socket (from iOS) using SetRequestContent.

I thought that would show up in the WebReqeust.entity, but it isn’t.

Can someone tell me how to extract that information?

If it is only parameters like value1=abc & value2=xyz then that should be in the URL.

However if you need to POST / PUT / DELETE some JSON content you should be able to use a xojo.Core.dictionary like this:

Dim aDictionary As New Xojo.Core.dictionary
//Set some values in the dictionary here
aDictionary.value("key") = "value"

dim postData As Text = xojo.data.GenerateJSON(aDictionary)

socket.SetRequestContent(Xojo.Core.TextEncoding.UTF8.ConvertTextToData(postData), "application/json")

Thank you Jeremie, that’s what I’m doing, but I can’t get it out on the server side. It’s just not showing up where I’m expecting it to be.

Don’t have enough experience with handling requests in Xojo web apps, I’ll wait for the experts’ valuable insight :slight_smile:

I think this was all my mistake. I didn’t put a key=value in there, I just put in a long JSON string.

Did you figure it out? We have been doing this for a long time no problem on XojoCloud.

Yeah, apparently I just need more hours of sleep a night and to pay attention!
How do I retract asking a stupid question!?!

Chris,

never a stupid question

Your post could help someone in the future :smiley:

Well Brian, I don’t know if this will help. I looked deeper and what I thought I was doing wrong, is exactly what I’m doing somewhere else and it’s working.

Either I’ve found an interesting bug or I’m breaking things in more places than I thought. If I did something meaningful, I’ll update this thread.