iPhone / .NET WCF的互操作性操作性、iPhone、NET、WCF

2023-09-04 01:28:51 作者:天生傲骨ミ怎能服輸

我在架构一个.NETWeb服务和iPhone应用程序,将使用这些服务。我很好奇,如果有对架构协议两者之间交换数据的最佳实践。基于SOAP的Web服务感到太重,我要一个iPhone应用程序。也许REST,JSON,POX呢?当然,应用程序的具体规定该协议在一定程度上,但我很好奇别人怎么做。

I'm architecting a .NET "web service" and an iPhone application that will consume these services. I'm curious if there are any best practices for architecting the protocol for exchanging data between the two. SOAP-based web services feel too heavy to me for an iPhone app. Perhaps REST, JSON, POX instead? Certainly the specifics of the application dictate the protocol to some degree, but I'm curious what others have done.

在理想情况下,我想利用WCF如果可能的话(再次,也许它REST,JSON,或POX支持),这样我可以保持我的选择余地创建其他绑定在未来的其他客户端应用程序。

Ideally, I'd like to leverage WCF if possible (again, perhaps its REST, JSON, or POX support) so that I can keep my options open for creating other bindings for other client applications in the future.

任何意见将是极大的AP preciated。

Any advice would be greatly appreciated.

感谢。

推荐答案

目前,我们正在使用WCF基于REST / POX的服务,为我们的应用程序之一。我会建议使用REST / POX坚持像您在.NET世界中通过添加服务引用那里没有类生成的Web服务(据我所知)在iPhone上。这将使解析了很多简单,因为你不会有担心所有额外垃圾肥皂增加了消息。

We're currently using a WCF based REST/POX service for one of our applications. I would recommend sticking with REST/POX as there are no class generators for web services (that i know of) on the iPhone like you get in the .NET world by adding a service reference. This will make the parsing a lot simpler as you wont have to worry about all the extra junk soap adds to the messages.

基本上看看NSURLConnection的和NSXmlParser和键值编码念起来(使XML解析轻松了很多),你就会有你需要得到它与code少量所做的一切

Basically take a look at NSUrlConnection and NSXmlParser and read up on "Key Value Coding" (makes the xml parsing a LOT easier) and you'll have everything you need to get it done with a minimal amount of code.