iPhone客户端服务器应用程序

问题描述:

对此我还很陌生,主要针对iPhone客户端服务器应用程序的后端(服务器端)实现,我有几个问题.

I am quite new to this and I have a few questions mainly about the backend (server side) implementation of an iPhone client server application.

1)我环顾四周,似乎JSON是与服务器通信的好方法.服务器需要什么才能使其正常工作?

1) I have looked around and it seems like JSON is a good approach to communicate with a server. What does the server need in order for this to work?

2)我看了几本教程,所有教程都使用api.somewebsite.com/rest/...格式的网址.此外,我只有

2) I have looked on several tutorials and all the tutorials use urls which are in the format of api.somewebsite.com/rest/... at the momement I only have http://www.websitename.com/Microsoft2.jsp. The user will then login using username and password to access content. Do I need to write an api to get it to work with the above?

我真的是服务器实现的新手,所以如果他们是新手,我会事先表示歉意.

I am really new to server implementation so I appologise in advance if they are newbie questions.

谢谢!

对于服务器,有多个框架和平台:

For the server, there are multiple frameworks and platforms:

  1. C#/.Net:WCF具有数据合约和序列化JSON/XML等的选项...
  2. 具有活动记录的Ruby on Rails:可以使用模型上的配置来序列化数据.
  3. Java:Jersey JAX-RS和其他框架很简单.
  4. 带有json扩展名的PHP
  5. 等...还有很多-搜索

iPhone端:

  1. ASIHttpRequest/SBJSON
  2. NSXmlParser:内置在iPhone中-如果您通过网络将序列化为xml.
  3. RestKit:一个更大的框架,它包装了包括通信和coredata集成在内的所有内容.
  4. 等等...很多其他人

关于XML与JSON. Json之所以出色,是因为javascript和网页可以轻松使用它(这是javascript对象表示法:).如果必须选择一种,那么您可以轻松地在任何地方消费.并非每个框架都有标准的JSON解析器-它正在迅速得到采用.例如,iOS 5具有json序列化程序. Xml被所有编程语言和框架广泛采用-每个框架都有一个良好的xml解析器.很难从javascript中使用(但有可能-更多代码).

Concerning XML vs. JSON. Json is great because javascript and web pages can consume it easily (it is javascript object notation :). If you have to choose one, that allows you to get consumed everywhere easily. Not every framework has standard JSON parsers - it's rapidly gaining adoption. For example, iOS 5 has json serializer. Xml is widely adopted across all programmatic languages and frameworks - every framework has a good xml parser. Harder to consume from javascript (but possible - more code).

希望这些指针有所帮助.

Hope those pointers help.