SetRequestContent from iOS

  1. 2 months ago

    Chris H

    Jun 11 Pre-Release Testers, Xojo Pro, XDC Speakers Grand Rapids Michigan

    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?

  2. Jeremie L

    Jun 11 Pre-Release Testers, XDC Speakers Europe (France) - getpackr.io
    Edited 2 months ago

    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")
  3. Chris H

    Jun 11 Pre-Release Testers, Xojo Pro, XDC Speakers Grand Rapids Michigan

    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.

  4. Jeremie L

    Jun 11 Pre-Release Testers, XDC Speakers Europe (France) - getpackr.io

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

  5. Chris H

    Jun 11 Pre-Release Testers, Xojo Pro, XDC Speakers Grand Rapids Michigan

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

  6. Steve K

    Jun 11 Pre-Release Testers, Xojo Pro Topeka, KS

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

  7. Chris H

    Jun 11 Pre-Release Testers, Xojo Pro, XDC Speakers Grand Rapids Michigan

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

  8. brian f

    Jun 11 Pre-Release Testers, Xojo Pro Chilly California

    Chris,

    never a stupid question

    Your post could help someone in the future :D

  9. Chris H

    Jun 11 Pre-Release Testers, Xojo Pro, XDC Speakers Grand Rapids Michigan

    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.

or Sign Up to reply!