如何调用Android的一个SOAP Web服务Android、SOAP、Web

2023-09-11 10:20:38 作者:三分书生气七分流氓范

我有很多的麻烦找上如何调用一个标准的SOAP / WSDL web服务与Android的有用信息。所有我能找到要么非常令人费解的文件,并提及kSoap2,然后一些位有关使用的 SAX 。好了,这很好,但它是2008年,所以我想应该有调用标准的web服务的一些好的库。

I am having a lot of trouble finding good information on how to call a standard SOAP/WSDL web service with Android. All I've been able to find are either very convoluted documents and references to "kSoap2" and then some bit about parsing it all manually with SAX. OK, that's fine, but it's 2008, so I figured there should be some good library for calling standard web services.

Web服务只是基本上是在的NetBeans 创建。我想有用于生成管道类IDE支持。我只需要最简单的/最优雅的方式从一个Android-联系 WSDL 基于Web的服务基于手机。

The web service is just basically one created in NetBeans. I would like to have IDE support for generating the plumbing classes. I just need the easiest/most-elegant way to contact a WSDL based web service from an Android-based phone.

推荐答案

Android不提供任何形式的SOAP库。您可以编写自己的,或者使用类似 KSOAP 2 。当你注意,其他人已经能够编译和使用kSOAP2在自己的项目,但我还没有过。

Android does not provide any sort of SOAP library. You can either write your own, or use something like kSOAP 2. As you note, others have been able to compile and use kSOAP2 in their own projects, but I haven't had to.

谷歌显示,迄今为止,在加入一个SOAP库,机器人兴趣不大。我怀疑这是他们宁愿支持目前的趋势在Web服务中对基于REST的服务,并使用JSON作为数据封装格式。或者,使用XMPP用于消息传递。但这只是猜测。

Google has shown, to date, little interest in adding a SOAP library to Android. My suspicion for this is that they'd rather support the current trends in Web Services toward REST-based services, and using JSON as a data encapsulation format. Or, using XMPP for messaging. But that is just conjecture.

基于XML的Web服务是在这个时候在Android上稍微不平凡的任务。不知道的NetBeans,我不能有可用的工具说话,但我认为,一个更好的图书馆应该可用。这是可能的XmlPullParser将节省您使用SAX,但我不很了解这一点。

XML-based web services are a slightly non-trivial task on Android at this time. Not knowing NetBeans, I can't speak to the tools available there, but I agree that a better library should be available. It is possible that the XmlPullParser will save you from using SAX, but I don't know much about that.