如何在 Android 上调用 SOAP 网络服务 [英] How to call a SOAP web service on Android

查看:26
本文介绍了如何在 Android 上调用 SOAP 网络服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难找到有关如何使用 Android 调用标准 SOAP/WSDL Web 服务的好信息.我所能找到的要么是非常复杂的文档和对kSoap2"的引用,然后是关于使用 SAX.好吧,那很好,但那是 2008 年,所以我想应该有一些很好的库来调用标准的网络服务.

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.

迄今为止,Google 对向 Android 添加 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.

这篇关于如何在 Android 上调用 SOAP 网络服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆