Post Data to Xojo Cloud

I have not done any Xojo Cloud work yet, but I was wondering about a few things.

Is it possible to have database app running in Xojo Cloud (SQLite) and also means to post data to the same database without using the app user interface? The specific application would be to have two means to post data to the database: the app running Xojo Cloud, and also a client iOS app (native Objective C). I currently do something similar with iOS apps posting to HTML forms.

If that is not possible, any other ideas how to leverage current iOS apps to populate a SQLite database residing on Xojo Cloud?

Lastly, has anyone seen any up-time problems with a Xojo Cloud app running 24/7 with Timer events firing at regular intervals?

You can upload data to web apps using HandleSpecialURL event and sending them as POST request.
We do that here, no problem.

[quote=85042:@Christian Schmitz]You can upload data to web apps using HandleSpecialURL event and sending them as POST request.
We do that here, no problem.[/quote]
That is exactly what I was looking for. Thanks Christian.

I am able to use HandleSpecialURL to receive POST data in a Xojo Web app running on a local network, but I haven’t been able to figure out how to receive POST data in a Xojo Web app running on Xojo Cloud. I’ve opened the Xojo Cloud firewall port for incoming traffic, checked the scope, etc., but still don’t seem to receive any incoming POST data in HandleSpecialURL when running in Xojo Cloud.

Has anybody successfully done this?

Yes. Is your local web app in the debugger? That’s a standalone web app while Xojo Cloud will be a CGI application. There was a fix in R2 that caused the old (incorrect) way to no longer work. Perhaps you are relying on the old way?

If memory serves it was a change to the WebRequest object.

@Bob: You are right–I had first tried the “old way”, which as you point out, won’t work anymore. ;-(

But even using the “new way”, I still wasn’t receiving incoming POST data on the Xojo Cloud.

Then Jason indicated that I need to listen for incoming data on port 80 (non-secure) or port 443 (secure).

So I tried those ports and started receiving data right away. I still have more work to do on the project, but I am making progress…

For what it’s worth, you shouldn’t need to Listen at all. The web app already does this for you.

@Greg: I’m not sure if I understand your note about not needing to Listen. I’m thinking that perhaps I mis-stated when I said I had to listen on port 80 or 443–more accurately I had to tell the firewall top open those ports in the Xojo Cloud firewall for incoming data. Once I did that with port 80 or 443, I was able to receive incoming POST data. And that was what I needed. :wink:

I’m confused. What is listening in your web app?

Those two ports are always open on Xojo Cloud servers, so there something else going on here.

@Bob/@Greg: Now I’m also a bit confused. :wink:

I thought my Xojo Cloud app had started receiving POST data because I used FireWallPort to open port 80 or 443, but I just took that code out and re-tested and I’m still receiving POST data.

SO–it seems that Greg is exactly right–those ports are always open, so opening them made no difference.

I am pretty sure that it wasn’t working before, but now it is working. I thought it started working because I used FireWallPort to open the ports, but that doesn’t seem to be the case. I must have changed something else that somehow made it start working.

If I figure out what I did wrong in the first place, I will post it.

But, the status at this point is that HandleSpecialURL is now working just fine to receive POST data in my Xojo Cloud app without using FireWallPort to open the ports.

And that is a good thing as it opens the door to using Xojo Web Apps and Xojo Cloud for more services related to our products. :wink:

Thank you for your suggestions and insights!

I think I found it the change that made my Xojo Cloud Web app start receiving POST data. It wasn’t in the Xojo Cloud App at all–it was in the URL that I was using to POST data to the app.

I had previously been posting to my Xojo Cloud app using a URL like:
http://x.x.x.x/Gateway-Alpha/

Per a suggestion from Jason, I tried posting to a URL of the form:
http://x.x.x.x/Gateway-Alpha/index.cgi/api/

I had also tried opening FireWallPort about the same time, but it seems that the key was appending /index.cgi/api/ to the URL, not using FireWallPort to open a port.

I’m still getting familiar with Web Apps and Xojo Cloud, but I believe this relates to use of a CGI app, which is why the problem didn’t come up when I was using a stand-alone Web App (Windows .exe) for my tests on a local network.

In any event, it is working very nicely now!

Yeah, it’s the presence of /api/ in the URL that triggers HandleSpecialURL. Otherwise, it tries to show the first page of your app.

For what it’s worth, HandleSpecialURL is triggered by /api/ and /special/. The new HandleURL event in 2014r3 allows you to use just about anything else.

For more information see my blog post… Hell Freezes Over…

I like it.