I need an advice if you may. I want to use webservices in Android and so far i am very much confuzed of the path i shoudl follow. I understand that there are 2 ways...soap and rest.
Trying to use soap(no native implementations) with a third party jar, ksoap.. that was fun but does not work. After finding a jar that actually compiles, and trying with some code i found on google i found that some methods do not exist in that jar and did not work.
Now I am trying to use Rest, found this project here and trying to get what they did here.
I worked once with webservices and using a wsdl url, and axis2 i managed to generate stub classes.
I am really confuzed now :) what is the best approach, what to use in android?
Thank you.
I would suggest using REST as it is light weight as compared to SOAP. Also people have reported lot of performance issues with libraries like kSoap.
If you still want to use SOAP create soap message on your own programmatically instead of using a library.
For JSON processing try using GSON library http://code.google.com/p/google-gson/
Related
I am currently going to write an Android and iOS app, which is heavily based on communication with RestAPI server.
My goal is to write communication, parsing, etc. only once. I've heard about Kotlin shared library, yet wasn't able to get it working yet.
Before wasting more time on trying to get that working, is that the way to go?
What other ways would you suggest to me?
Thank you
What you are looking for is probably Kotlin MultiPlatform Projects. Check out https://ktor.io, which allows you to write networking code only once. Also checkout https://github.com/Kotlin/kotlinx.serialization for JSON serialization.
I have created a Rest Web service using Jersey in a Java EE app. And I was able to create the client in a java app as well. I worked fine.
I'm now trying to consume my Web Service, but this time using Android.
I understood that Jersey libraries are not android oriented (Is that even true ? Please confirm this information ) and I read that Restlet is an alternative to build the Android Client.
How is that possible ? do you have any tutorials or documentation I can read for this purpose ?
"I understood that Jersey libraries are not android oriented (Is that even true ? Please confirm this information )"
This is pretty obvious. If you do the search on the jersey site, nothing shows up.
Also, it's pretty hard to find tutorial about Restlet on Android. I think you have to adapt from Java version. Personally, I use a plain http client to do REST stuff. (I think many people also do that.)
Regarding Restlet, you might find these useful:
http://weblogs.asp.net/uruit/archive/2011/09/13/accessing-odata-from-android-using-restlet.aspx
http://restlet.org/learn/guide/2.1/editions/android/
http://blog.restlet.com/2009/05/06/restlet-available-on-android-phones/
These questions are very helpful if you change your mind and want to do it without a framework.
Restful API service
Need sample Android REST Client project which implements Virgil Dobjanschi REST implementation pattern
I've seen people having trouble with using Jersey on Android before. You have to battle through a lot of exceptions to get it to work. There is a library on github that attempts to provide android support for jersey but I've not used it myself.
Restlet is available on android phones and you will have an easier time integrating it and getting it to work. However, I've personally found that using the HTTP client library on Android coupled with an external library to perform serialization / deserialization ( like gson ) is the easiest route to writing a REST client.
Currently I am working on an iPhone app. But the company also would like to have an android version for this app.
I have programmed all the request by Soap and used for the iPhone the Soap Request Generator of Sudz-C.
I am wondering now if something similar exists for the Android, It would be nice if I don't have to program this all by myself.
Anyone have some experiences or ideas?
You can use
http://easywsdl.com
website to generate all required java classes for your webservice. It uses ksoap2 library and supports many features like objects sent as references (WCF IsReference), complex inheritance, document and rpc style of webservice, all standard data types (including normal enums and IsFlag enums), and much more
ksoap2-android is what you are looking for, it will send/recive soap request's, is easy to use and on MIT license
I go through a lot of solution solution in WSDL 2 android. google don't matter about SOAP service and provide anything for it. wsdl2java won't work in most of case, some library cannot be use by android SDK. I suggest you to use http://easywsdl.com.
you'll see you can edit your own package name, class prefix and many other parameters depends on your need. If you have complex data and your are familiar to use Gson (https://code.google.com/p/google-gson/) to send parameter between your activities don't check "Use JodaDate" that is a great library for using date, but Gson doesn't support it (yet).
If you have few services that don't work (yes that can happen, depend of your WSDL configuration file), report it to contact and they will make the possible to fix your issue like they did for me.
The generator is fast. you will receive all your generated code and the .jar that you'll have to import into your project.
I'm looking for an alternative HTTP client library than what is already included in the SDK. I haven't been able to find any. Does anyone know of any? It doesn't have to be open source.
Many of the issues with Android's built in HttpClient are related issues that have been resolved in HttpClient 4.1. Dirk Boye has created a script to convert the HttpClient 4.1 sources into an Android friendly package. You can find some prepackaged jar files and his script here: https://code.google.com/p/httpclientandroidlib/
You have different options to manage networking in Android:
OkHttp (needs Okio) + Volley + Gson: is a common REST solution for JSON based APIs. You can use each of these tools separately, so for example if you don't need JSON serialization/deserialization you can just use OkHttp + Volley (where OkHttp is the Http client and Volley is a REST library/helper that offers an easy way to load images as well). If you just want an alternative Http client you can use OkHttp(+Okio) which is the best one or among them right now. OkHttp needs Okio(that you can use as well separately) and is a library that complements java.io and java.nio to make it much easier to access, store, and process your data. You can find more information about this solution here..
OkHttp (needs Okio) + Retrofit + Moshi + Picasso. This option is pretty much equivalent to the previous one. Retrofit is comparable to Volley, Moshi to Gson and Picasso is on image loading department. All of this stuff was mainly developed by the same guys and all tied together works like a charm. More on that here.
ION is a very good library that tries to deal with a lot of stuff mention in the options 1 and 2 (Http client, REST helper, uses Gson as well and load images). Better check this out.
Android Async Http: I haven't tried and don't have any information about it, but looks like might be worth taking a look.
I'd say the option 1 is being replace by the option 2. The option 3 has a lot of fans and is developed basically by one (awesome) guy, but offers a LOT of things that you might be not using. That's the reason the Square guys (guys behind option 2) have split everything in 5 different libraries. I can't say much about the option 4. I might be checking it out soon.
Notable mention is Glide, that is (maybe) the best image loading library today developed by the (Google acquired) Bumptech guys.
A guy working on Okio/OkHttp was working in Google on the SDK http client, worked on Gson and is working on Moshi. That's the reason I am more inclined for the option 2 nowadays, people use to do better stuff than previously, or at least not worse.
OkHttp by Square is a good alternative.
Volley made by Google is also great in design.
i am using a WSClient++ Java for Android project to generate the classes of my webservice but the version is the trial soo the program only generate two methods. My webservice have only one but miss some classes after generating. Anyone knows other software like this?
thanks
I think you can use DOM t generate your xml from WS. (http://www.w3schools.com/dom/default.asp)
Also, generate the Web service using simple java program with the help of Apache tomcat and Axis2. (http://www.eclipse.org/webtools/jst/components/ws/1.5/tutorials/BottomUpWebService/BottomUpWebService.html)
Then call these Web Service in Android using kSAOP library.
Regards,
Sneha