2

The scenario

I am building a hybrid app, using Phonegap. I have an SQLite database (students) with a table(namelist) containing list of names inside the project. From JavaScript, I can't execute an SQL query.

The need

On a button click event in the UIWebView, An ajax call to a webservice should execute the select query and zap the names in a json, populate it in the div inside UIWebView. This part I can handle it. The missing link is the codebehind. We need a server scripting langauge like PHP or ASP to connect to the db and retrieve data. However, I want to do it on my app itself. So I came across Bonjour for publish, discovery and resolution of service.

The doubt

Is it possible to expose a method as a webservice with Bonjour. Take for example, in Python, when we use the cherrypy framework we use the annotation @expose to expose a method as service.

import cherrypy
from cherrypy import expose

class Services:
@expose
def add(self,a,b):
    return a+b

 cherrypy.quickstart(new Service())

Sorry for dragging python into this, but how do I expose an Objective C method as a web service with Bonjour? Am I making sense at all? :D

thandasoru
  • 1,558
  • 2
  • 15
  • 41

0 Answers0