简体   繁体   English

wsdl2objc和类似的SOAP客户端生成器真的是iOS和OS X的最佳选择吗?

[英]Is wsdl2objc and similar SOAP client generators really the best choice for iOS and OS X?

I do realize that this question seems very well known, but since I don't have a lot of experience using SOAP web services and as far as I could find this is not very common topic on iOS and especially OS X, I will ask it again. 我确实意识到这个问题似乎是众所周知的,但是由于我没有使用SOAP Web服务的丰富经验,并且据我所知,这在iOS尤其是OS X上不是很常见,所以我会问它再次。

I have tried wsdl2objc and sudzobjc and both solutions seem to be pretty much complex. 我尝试了wsdl2objc和sudzobjc,这两种解决方案似乎都非常复杂。 I have a feeling that there is a lot of overhead, too, especially with all those types defined and pointers used. 我感觉到也有很多开销,尤其是在定义所有这些类型和使用指针的情况下。

If I compare this to simply using standard Cocoa classes NSURLConnection and NSXMLParser like in this example: 如果将此与仅使用标准可可类NSURLConnection和NSXMLParser进行比较,如本例所示:

http://abhicodehelp.blogspot.com/2010/12/handling-soap-with-iphone.html http://abhicodehelp.blogspot.com/2010/12/handling-soap-with-iphone.html

like when using RESTful web services, it feels like overkill... 就像使用RESTful Web服务时一样,感觉就像是过分地...

I would appreciate anybody to give me a hint, why this more complete approach is better and wouldn't it be better to use any other C or C++ libraries that at least by first look seem much lighter and easier to use? 我希望有人能给我一个提示,为什么这种更完整的方法更好,并且使用至少看起来乍一看又更容易使用的任何其他C或C ++库不是更好吗?

The problem of SOAP is that it's really, really bloated! SOAP的问题在于它确实非常膨胀! It's called Simple Object Access Protocoll but it's anything but simple. 它称为简单对象访问协议,但绝非简单。 It's based on XML and (mis)uses all of it's complexity with WSDL and XMLSchemes and all that stuff. 它基于XML,在WSDL和XMLSchemes以及所有其他东西中都使用了所有的复杂性。 I started working with SOAP in my Java time as it was just invented. 我是在Java发明之初就开始使用SOAP的。 And we had OutOfMemoryExceptions more than once because of the size of the XML message. 由于XML消息的大小,我们多次遇到OutOfMemoryExceptions。

That said: calling SOAP services with Objective-C will be as complicated as it is with Java or any other language. 就是说:使用Objective-C调用SOAP服务将与使用Java或任何其他语言一样复杂。 The problem is you need to create rather (or even very) complex XML structures to call a service. 问题是您需要创建相当(甚至非常)复杂的XML结构来调用服务。 I knew wsdl2java and that helped a bit but it created a whole bunch of classes and abstractions and stuff. 我知道wsdl2java,这有所帮助,但是它创建了很多类,抽象和东西。

I understand the idea behind WSDL and all the XMLSchema stuff that's used in SOAP. 我了解WSDL和SOAP中使用的所有XMLSchema背后的思想。 It's to create a service and it's specification so that others can call it without problems. 这是为了创建服务及其规范,以便其他人可以毫无问题地调用它。 But I don't think that's the way to do it. 但是我不认为这是这样做的方式。

If you've got the choice take REST! 如果您有选择,请选择REST! REST is the real "Simple Object Access Protocoll" as it really is simple. REST是真正的“简单对象访问协议”,因为它确实很简单。 And it can also use XML as a message format, even though you wouldn't want to. 它也可以使用XML作为消息格式,即使您不想这样做也是如此。 REST with JSON is the way to go. 带有JSON的REST是必经之路。 You only need to understand HTTP to understand REST, IMHO. 您只需要了解HTTP即可了解REST,恕我直言。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM