2

So I've been doing research and I know that I will need to create a aspx script and run a query in aspx. Then convert the data into XML format for objective C to parse through it.

My question is can anyone elaborate a little bit more? I have little knowledge of xml and aspx.

For example example.com/test.aspx queries a user table, then I can get it to display on the browser. But what next? Convert it to xml format? Then how would my app retrieve the xml?

Thanks

bryanmac
  • 38,941
  • 11
  • 91
  • 99
terezzy
  • 243
  • 1
  • 3
  • 8

1 Answers1

1

Check out asp.net web api - this covers how to expose CRUD operations. The server web-api would either use ado.net to query the database directly and populate objects that then get serialized over the wire or you could use something like the entity framework or something like NHibernate to get the objects from the DB.

In iOS/Cocoa objective-c you would use the NSURLConnection to make a request to the web api server.

If the server is configured to return XML (your request sets accept header to application/xml), then in objective-c you would use NSXMLParser.

But, the more web friendly/modern approach is the http server could return json (request sets accept header to application/json) as the data and in iOS 5 and beyond, there's a JSON parser: http://www.raywenderlich.com/5492/working-with-json-in-ios-5

Community
  • 1
  • 1
bryanmac
  • 38,941
  • 11
  • 91
  • 99
  • Web api is the right choice - you're building an API to you data over HTTP, not a web page. ASPX would be totally the wrong way to go here. – saille Oct 27 '12 at 00:43