I have not found any convinient way to create something like a jaxws wrapperclass for an existing Soap Webservice - like in full Java.
Jaxws is unfortunately not avaliable in the sdk.
Is there any was to do this without using any external libs?
Are there any external libs at all yet?
The short answer is that no, there isn't any way to do exactly what you want. However, there is a DOM and SAX implementation. If you know what the incoming XML looks like (which you should anyways) then you could write a custom unmarshaller.
I really don't want to manually write/decode any soap messages. I just want to consume an external webservice. Its really easy to do that with full blown java libs and tools (wsimport) and create the corresponding wrapper-classes to access the ws as "normal" java classes.
The usual ws client programmer will never need to touch any backend soap stuff at all... Thats what the jaxws client classes are for.
ksoap is unfortunately only a first step to access soap stuff at all - no wsdl-based codegeneration so far as I know...
Hopefully the sdk will adress this issua in one of the next versions as many ws are out there and handcoding this stuff is really messy...
Related
I have a SOAP Web Service that i want to parse and use in my android project. I have read that there is a website that auto generates the java classes by importing the url (wsl2code) but it seems to have flaws. Additionally the sample they provide is not working. What is the best and correct way of generating java classes from a WSDL url for my android project?
Use ksoal2 library for soap service which is light weight for android but the think you have to create service call manually
To answer my own question, I have used the service of wsdl2code http://www.wsdl2code.com/pages/home.aspx . Just some information regarding that, it has some limitations like
Don't Support byref Variables , in class
Don't Support Boolean& Variables , in class
Don't Support Int64& Variables , in class
Methods that are boolean or a custom class are turned to void and must be modified manually
Overall though this website saved me since it would take me a while to create the classes I needed by myself. It might have taken me a while to modify the classes but still saved a lot of time.
I'm creating an Android application which uses RoboSpice for asynchronous network calls. Although I have no experience with RoboSpice, I've chosen for RoboSpice as it's regarded as one of the best on the internet, and because it can automatically convert JSON to POJO's. Unfortunately, the quality of the documentation of RoboSpice is a bit poor. Therefore my question:
I've succesfully used RoboSpice to make a network call to a REST GET method, automatically parse the JSON to a POJO and show the list of retrieved objects in an Android ViewPager. I'm using Jackson2GoogleHttpClientSpiceService to do this. Now, in this ViewPager I'm showing an image as well. Obviously, I want to download this image using RoboSpice. I've used one of the RoboSpice examples (which uses the OkHttpBitmapSpiceManager to download an image) as a guide and according to that I've added this line to my activity:
private OkHttpBitmapSpiceManager spiceManagerBinary = new OkHttpBitmapSpiceManager();
Also, I've added this line to the manifest:
<service
android:name="com.octo.android.robospice.spicelist.okhttp.OkHttpBitmapSpiceService"
android:exported="false" />
Now, as I'm not using maven for my Android project, I had to add the following jar to my project: robospice-ui-spicelist-1.4.9.jar (I've obviously added all the other necessary jar's for using the Jackson2GoogleHttpClientSpiceService, which works).
The problem is, the application fails to even start. Whenever I remove (or comment) the line containing the new OkHttpBitmapSpiceManager() the application works flawlessly. So apparently calling the constructor is what makes the application crash. I get the following error from the logcat:
java.lang.NoClassDefFoundError: com.octo.android.robospice.spicelist.okhttp.OkHttpBitmapSpiceService
To me, this error seems to relate to a missing jar or something. But I've added all the necessary jar's according to the documentation. Can someone with experience of RoboSpice explain to me what I'm doing wrong here? Should I add more jar's or am I missing something else? Or should I even use a completely different approach to loading images from a URL using RoboSpice?
EDIT!
To make it more clear, I've added the following jar's to my libs folder and the build path:
commons-io-1.3.2.jar
commons-lang3-3.1.jar
google-http-client-1.17.0-rc.jar
google-http-client-android-1.17.0-rc.jar
google-http-client-jackson2-1.17.0-rc.jar
guava-jdk5-13.0.jar
jackson-core-2.1.3.jar
jsr305-1.3.9.jar
robospice-1.4.9.jar
robospice-cache-1.4.9.jar
robospice-google-http-client-1.4.9.jar
robospice-ui-spicelist-1.4.9.jar
The problem is that you are not using a jar that contains the service class : com.octo.android.robospice.spicelist.okhttp.OkHttpBitmapSpiceService.
It is not contained in robospice-ui-spice-list but in robospice-okhttp. If you include this jar, you will get the service you need.
Have a look at this sample.
Also, please not that to download an image, it can be even easier to use non okhttp related classes. RS offers simple binary requests in its core package.
Oh, and btw, when you say "RS docs is a bit poor", please let us now via github or the mailing list how you would like to see it more complete. We also accept pull requests, even only for documentation.
Title says all.
Can i use mysql/oracle database in Android application even if it's very slow and bad ?
Remotely by using a webservice yes.
Locally , it's theorically possible but you probably have to :
have a rooted phone
recompile the source code of your DBMS to support the arm architecture (or whatever your phone use)
find/create a driver for java (supported by dalvik) which support this DBMS
find/create an api for this DBMS
Long story short , you don't want to do that ! It's cleary not a good solution.
And to be honest using DBMS like oracle on a phone , it is like using a rocket launcher to kill a fly ...
Note : you can have a look on this documentation about berkley DB on android
As far as i understand you need local database running on Android. That means MySQL/Oracle are not choice.
As there is only java - you can try to use java based DB. There are few on internet. Of course they have to be ported.
Yes, you can.
You just have to create .php that gonna get informations from the databases and return you a json.
In Android you create a httprequest in wich you target the .php file and analyze the json.
In my Android app, I need to talk to a webserver that expects marshalled objects of complex classes. These custom classes were produces from a WSDL file, so they already come with annotations. The server uses JAXB for marhalling and unmarhalling.
So, on the client side, using JAXB, I would simple to this:
JAXBContext jc = JAXBContext.newInstance("schema_definition_path");
Marshaller m = jc.createMarshaller();
Unmarshaller u = jc.createUnmarshaller();
...and then use the Marshaller and Unmarshaller instances to work serialize/deserialize the custom objects.
Since, it's not a great idea to use the heavy-weight JAXB lib in mobile apps, I am looking for an alternative to do what JAXB does for me here.
I checked out Simple XML Serialization, but that doesn't seem to provide this kind of functionality. I can only give a class to the unmarshaller instead of the schema definition path. Doing this results in an incomplete xml document, containing only the root element.
Can anyone point me in the right direction, please? Is this even possible? Should I use a different lib - which one? I am I just misusing SimpleXML?
Since I couldn't find any better way (see comments to the original question), I decided to manually convert the Objects using the XML Pull API implementation included in Android.
Here is a short tutorial on how to use it: http://www.ibm.com/developerworks/opensource/library/x-android/
I'm not saying it's a good way, but it's the only thing I can think of that will work and where I don't have to touch the original classes.
Is there a definitive method of creating either a PDF or a MS Word Doc file within the app and email it immediately (and possibly, also store it).
I have been trying for quite some time and have found out the JAVA libraries: apwlibrary and iText. But both of them dont provide any tutorials of sorts.
Could anyone point me in the right direction?
EDIT: Come to think of it, is could an online PDF generator be used, first by sending the data to the service, then retrieve the result and save it on the phone?
I would recommend apache fop http://xmlgraphics.apache.org/fop/
you can use standard FOP to generate pdf.
Unless it is a core feature of your device to create a pdf file I would suggest not to do it yourself. Adding PDF creation is going to be quite a lot of work potentially depending on your performance needs. Java libraries will be easier to add but less performant. Native libraries combined with Java will be more hazzle to maintain build and bug fixing wise.
If you just need to email some information why dont you create a message text in html and use a intent to email it with the build in email program instead? Or if you want you could e.g. put the PDF generation on a server and just email a link..
I'm working right now with JasperReports, an open source library to create reports in Java and export them to PDF, DOC, XLS... Using it in conjunction with iReport to create a group of templates makes it really easy to create files filled with content from different types of sources (I'm using JavaBeans).
If you don't like the idea of having static templates (That's a bit annoying depending on your needs), you can always take a look at DynamicJasper (The examples on the website are great).
Good Luck!
I have used Apache POI. It seemed to work well. http://poi.apache.org/
This actually, http://poi.apache.org/hwpf/