Help with WebServices and Databases

Hi guys,

I am on the verge of trying to use Corona SDK to create a data driven application for work. I have tried using both Eclipse and Xamarin to achieve this, but to be honest I find both extremely difficult and unstable.

The web service I want to consume within Corona was originally developed in Visual Studio.net and written in Visual Basic.net, so im unsure if Corona will be able to read this? As I created the web service originally, I will have the full flexibitly to modify it, or even re-create it. The only thing is I would like to still develop the web service within Visual Basic using vb.net.

I have seen various examples within these forums using JSON? but my question is can Corona consume SOAP or WCF web services? And if so, which is the best and easiest to use?

I also need a database. My overall plan is to read the data from the web service, and insert it in to a database on the Android device, Which type of database is available on the android device? And would it be easy(ish) to achieve what i want in Corona?

Thanks guys.

Hi Samo.

You can use any type of language in the server side, PHP, VB.NET, …   The communication between the your server and the mobile is done thru http request. 

In my case, I use a vb.net webpage as my webserver. My mobile application send to the webpage some info via GET or POST params. The server reads these params, executes some database operations and returns a JSON to the mobile.

In terms of local database, I know that Corona supports sqllite but I never used. 

Many thanks for the reply Renato. Do you happen to have a short example of your WebService, and how you consume this within Corona?

Sure. Just to be technically correct, it is not a WebService, it is a normal WebPage, but in the ends it works the same.

You can find my example in my blog: http://www.AdventuresOfAnEntrepreneur.net/

Any question in running it, just let me know.

Let me add a couple of thoughts to this. 

First, network.request() simply captures the output from a web server.  Your web server can output whatever it does and you end up with it in a chunk of your app’s memory.  How you parse that data is really the tricky part. 

The reason we promote JSON is that it’s a nice string that converts well to Lua tables.  In other word’s it’s key-value pairs.  Data formats like XML are not simple K-V pairs.  You have tags and tags have descendents and they have attributes and is generally much harder to parse and because the attribute vs. value issue.  There are XML parsers and at least one blog post in our Blogs on working with XML so it can be done.  JSON makes your life easy and that’s what Corona SDK’s about.

SOAP has traditionally been a problem because it has some odd authentication and session tracking that REST type API’s don’t need.  We’ve had one of our customers figured SOAP out and we are working on trying to get that information to you.  I’m not sure if it was “just figured out” or if it became more possible with our new 2.0 version of the network.request() API.

Hi Samo.

You can use any type of language in the server side, PHP, VB.NET, …   The communication between the your server and the mobile is done thru http request. 

In my case, I use a vb.net webpage as my webserver. My mobile application send to the webpage some info via GET or POST params. The server reads these params, executes some database operations and returns a JSON to the mobile.

In terms of local database, I know that Corona supports sqllite but I never used. 

Many thanks for the reply Renato. Do you happen to have a short example of your WebService, and how you consume this within Corona?

Sure. Just to be technically correct, it is not a WebService, it is a normal WebPage, but in the ends it works the same.

You can find my example in my blog: http://www.AdventuresOfAnEntrepreneur.net/

Any question in running it, just let me know.

Let me add a couple of thoughts to this. 

First, network.request() simply captures the output from a web server.  Your web server can output whatever it does and you end up with it in a chunk of your app’s memory.  How you parse that data is really the tricky part. 

The reason we promote JSON is that it’s a nice string that converts well to Lua tables.  In other word’s it’s key-value pairs.  Data formats like XML are not simple K-V pairs.  You have tags and tags have descendents and they have attributes and is generally much harder to parse and because the attribute vs. value issue.  There are XML parsers and at least one blog post in our Blogs on working with XML so it can be done.  JSON makes your life easy and that’s what Corona SDK’s about.

SOAP has traditionally been a problem because it has some odd authentication and session tracking that REST type API’s don’t need.  We’ve had one of our customers figured SOAP out and we are working on trying to get that information to you.  I’m not sure if it was “just figured out” or if it became more possible with our new 2.0 version of the network.request() API.