如何使用WCF Android中如何使用、WCF、Android

2023-09-06 18:55:16 作者:归宿

我提供了通过WCF Web服务的远程工具到其他网站。现在,我想提供相同的远程工具,Android应用程序。我的问题是:Android应用程序可以消耗我的WCF Web服务(托管网络服务器上),或者我需要改变某些事情了。

I provide a remote tool to other websites through web service in WCF. Now I want to provide same remote tool to Android Apps. My question is: Can Android apps consume my WCF web services (hosted on webserver) or do I need to change something.

推荐答案

您有WCF服务,你希望从Android应用程序使用它。首先你的服务必须是可互操作。在Android客户端的情况下,你应该使用 basicHttpBinding的(SOAP服务)或的WebHttpBinding (REST服务)。

You have WCF service and you want to consume it from Android application. First of all your service must be interoperable. In case of Android client you should use either basicHttpBinding (SOAP service) or webHttpBinding (REST service).

要消耗SOAP服务使用 kSoap2 - here一些描述如何调用该服务要消耗REST服务使用使用 DefaultHttpClient 并调用serivice其他任何HTTP资源(REST的服务,最好是使用JSON作为传输格式) - 的这里是一些例子。 To consume SOAP service use kSoap2 - here is some description how to call the service To consume REST service use use DefaultHttpClient and call the serivice as any other HTTP resource (for REST service it is better to use JSON as a transport format) - here is some example.