开发者

Consume ado.net data service from android 2.1

开发者 https://www.devze.com 2022-12-21 19:43 出处:网络
I have a ado.net data service created using VS 2008 sp 1 that is hosted that I want to consume via HTTP and JSON from Android 2.1? Does anyone have sample code on how to do CRUD operations eas开发者_C

I have a ado.net data service created using VS 2008 sp 1 that is hosted that I want to consume via HTTP and JSON from Android 2.1? Does anyone have sample code on how to do CRUD operations eas开发者_C百科ily do this? I heard Restlet makes this very easy but can't seem to find sample Android code on doing this. If someone can post a tutorial with some actual code that would be greatly appreciated.


here is a good link..

http://composedcrap.blogspot.com/2009/08/connecting-to-net-web-service-from.html

It uses ksoap2 API

http://www.tuxpan.com/android-soap/android-ksoap2-build.zip

another link from right here on SO...

How to call a .NET Webservice from Android using KSOAP2?

And here is a link for Android to WCF....

Can't connect to WCF service on Android

For a RESTful WCF service, here is a good tutorial...

http://mypetprojects.blogspot.com/2009/05/communication-between-wcf-service-and.html


I found another link: http://wiki.restlet.org/docs_2.0/13-restlet/28-restlet/287-restlet/288-restlet.html

Seems usefull.

(+1 for Eclipsed4utoo for all the links!)


Reached here late(or very late) but may help someone in present or future. If you are looking to consume a ado.net data service(now renamed WCF Data Service) from android client, I would recommend you to have a look at the OData4j library. It provides an easy way to access such a service in both xml and json format. Also, it is faster than RESTlet.
Sample code:

ODataConsumer c = ODataJerseyConsumer.create("http://url/WebService.svc");

List<OEntity> listEntities = c.getEntities("Movies").execute().toList();

if (listEntities.size() > 0 ) {

for(OEntity entity : listEntities) {

System.out.println(entity.getProperty("MovieID").getValue().toString());
   }
}

You can find more on WCF Data Service and OData4j here.

0

精彩评论

暂无评论...
验证码 换一张
取 消