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.
Related
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.
please explain a little about the ksoap android objects. I couldn't find any help anywhere.
what is the meaning and purpose of "namespace" when declaring a ksoap object?
what is the purpose of "SoapSerializationEnvelope" object?
what is the purpose of "HttpTransportSE" object?
KSOAP is a SOAP API based on kXML,where kXML is a lightweight Java-based XML parser designed to run on limited, embedded systems such as personal mobile devices
Check this link for details.
Difference Between SOAP and KSOAP
According to this webpage:-
The ksoap2-android project provides a lightweight and efficient SOAP
client library for the Android platform.
It is a fork of the kSOAP2 library that is tested mostly on the
Android platform, but should also work on other platforms using Java
libraries. It is still using Java 1.3 so should work fine on JavaME,
Blackberry and so on.
I want to learn how to consume web services in android , and i have done some research on it , i have seen that .net web services are in XML format and return response in XML, when PHP web services are give jason array in response , i have used ksoap for .net web services , is ksoap can also used for php web services?
I think you misunderstood. .Net is not only to generate data in XML format.It is also possible to generate JSON data using .NET also and it is also possible to generate XML format using php.Most of the people will use JSON only because it is light weight and its easy parse from client side.Parsing XML data is really pain in my opinion.
And you asked ksoap also used for php?Yes it is.
See the below link
http://www.petetracey.com/2009/11/ksoap-with-php-tutorial/
Above site is my site so thought I'd clear this up a bit -- SOAP is a protocol that uses XML as its underlying format. It's one of many options that use XML. KSOAP (with the K) is the Java library, for blackberry but may be somewhere in the android libs or tacked on somehow. Still I think the better option is JSON, it is lighter weight and parses faster and therefore for mobile with data rates/limited processing power/battery consumption goes up with processor use -- you want to be lean and mean.
So any modern language, be it PHP, .NET, whathaveyou++, has libraries for both JSON and XML - and most have SOAP either built-in or as the 3rd party library somewhere. Which to use is the right tool for the job, and SOAP at this point is pretty much a legacy technology outside of the Sun/Oracle and Microsoft world.
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/
I'm going to develope an application based on web services (axis2) and android (clients).
I'm now planning the logic architecture for my system and I supose that it should be like a SOA architecture. I have seen that a SOA architecture is based on layers.
So, this would be a "correct" logic architecture for my application? (with some changes of course)
http://geeks.ms/cfs-filesystemfile.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/unai/DDD_5F00_NLAYER_5F00_ARCHITECTURE_5F00_SMALL_5F00_6ADA95E1.png
Android code (activities) would be on Presentation Layer?
EDIT
April 2014
Now, 3 years later with some more experience... REST is the best :)
Warning, it may that this answer is not at all an answer to you question but anyway, here is my thoughts.
I'm definitely not a SOA specialist but since SOA can be implemented with REST, it should not have any consequences on a SOA architecture. Android is REST-ready (see that Google IO 2010 session on REST) and there is only little SOAP support on android (afaik, but I may be wrong).
At some point, you'll have to evaluate the feasibility of the interop. between your Axis WS-* with any existing android SOAP support (the well-known ksoap2 project for example). The result could be not without impact on your architecture design.
The point here is: if you do use Rampart to use WS-Security, for example, on top of Axis2, it seems to me there are little chances that ksoap may interact at all (technically) with your service provider. On the one hand, if the service is simple and can be bound with ksoap2, great, go on. On the other hand, if you would use a not so simple security or authentication scheme, it could just be a nightmare to get the things done with the simple SOAP support on android. In the latest case and as the REST approach seems to be the preferred philosophy on android, you may be confronted to the decision to have a REST proxy dedicated to android between your Axis2 business WS and the android client-side application.
In the hope it may be of any help.
Perhaps you could even try SOAP. Android supports SOAP web services and provides ksoap2 libraries which you can use for sending request and getting response from your server easily.
For starters just check this out. Now, the latest version of ksoap also supports passing of Object Arrays.
For more information of ksoap2, I suggest to read this
Cheers
All the best