add web service reference to eclipse - java

I'm building a android application and I need to consume a web service. I am using eclipse as my ide.
Does Eclipse have a nice easy way to add the web service to the project like the way visual studio does?
Is there a plugin?
I tried this http://wsdl2javawizard.sourceforge.net/ but I cant find "Import Web Reference" in my latest version of eclipse
Thanks for the help

World,
In android/java nothing exist like add service or add webservice reference facility as you have in visual studio.
So, you need to first do analysis of following to proceed further:
1) Either you are using soap based webservice? or restful api?
A: If you are using soapbased service that is developed in dotnet then you need to use any free library to consume it like: (ksoap) i used 1 year ago.
B: similary if you are using restfull with json (then Gson is the Google library which is very easy and helpful.
I hope i have given you the direction now you can explore these yourself :)

Related

Write own Java logic on https://restlet.com

I tried learning things via tutorials on https://restlet.com but unable to figure out whether can I write my own custom Java logic on https://restlet.com API?
All it allows is to download generated Java code.
Appreciate if you can guide/help.
Do you want to create your API and let APISpark host and run it for you?
Do you want to just develop your own Web server using the Restlet Framework ? In this case you can still use APISpark or the Studio in order to get a server skeleton that you will have to complete. You can also develop it manually by using the Restlet Framework.
Best regards,
Thierry Boileau

Create a group on openfire from an Android app

I developed a chat application (Android platform, native Android development) using asmack library. Also I have a task to create from the application group in openfire server. I don't know how to do it.
And also additional question: is it possible or not?
You could use the Openfire REST API plugin, which allow you to create new groups over REST/HTTP e.g. from your application.
Look here: https://www.igniterealtime.org/projects/openfire/plugins/restapi/readme.html#create-a-group
However this question is old and already answered, I am adding for the peoples which are still looking for quick and easy solution.
I have written a client library and have used in one of my project. Library is available on github -https://github.com/xibsked/Openfire-Rest-Api-Client-Android

How to go about creating SOAP webservice in Java

I did some Core Java programming a decade back. Now I've got a project to create SOAP website.
I've a Windows machine setup on Amazon with Eclipse installed on it.
I thought of buying this book: http://shop.oreilly.com/product/9780596001759.do but it was released in 2002 and it's contents may be obsolete.
I could not find any other stuff about how to go about creating SOAP webservice in Java.
Please HELP!
So I want to know step by step procedure, setting up the IDE + libraries etc.
Read some tutorial from internet for creating jax-ws webservice.
If you want to read some books I would recommend these two books :
1.Java Web Services: Up and Running
2.Apache CXF Web Service Development
You can use axis2 for creating your webservices. Axis2 Web Service using Eclipse will give you some help about creating one.
The standard way is to use JaxWS, which is a part of Java 6 and later. The approach varies depending if you use the "Java classes first" or "Contract first" approach.
I always use contract first:
Write the WSDL and any supporting XSDs that might be required
Create the Java classes using wsimport (command line or as a Maven plugin)
Add the business logic to the generated class
There are multiple tutorials on the web. Search on JaxWS and wsimport.
The integration with Java even allows you to publish a web service from a triial command line program.

Auto code generator to consume web services from Android

I'm using ksoap2 to consume web services from Android projects. Everything is working fine but I miss some properties in the library which I think are pretty common.
In Visual Studio when adding a web service reference all the necessary code so you can consume the web service is created, and even more important, the necessary classes for the objects/types returned by the web service. The same can be done in XCode or in Eclipse when using Java EE.
The closer I get to this in Android is http://code.google.com/p/android-soap-enabler/wiki/FiveMinutesTutorial I tried but I had some problems and I let it go.
It's hard to believe that there is no standard way to solve this issue. I mean, I guess there exists so many Android Apps consuming web services, and no one has a better way than manually parse the xml response using the ksoap2 library? What finally makes it even weird, is that I didn't find anyone asking this question. Is it so strange what I'm asking? Am I the first one with this problem?
I would like to know if there is any tool/library/project/whatever which automatically creates the necessary code for consuming the web services.

missing JSON libraries for Google App Engine application?

I recently purchased a copy of Practical Android Projects. Chapter 8 talks about how to use Google App Engine with Android. It gives as an example (source code available here in the folders PracticalAndroidProjectsSourceCode/Projects/08_GameManager and 08_GameService) an Android application which consumes a web service from an App Engine application.
I haven't been able to get the example App Engine application (which provides the service) to run correctly. The problem is that the application expects JSON libraries which aren't available. I've tried downloading JSON libraries from elsewhere on the web as JAR files and including them in the application. (See discussion.) This hasn't worked, because none of the JSON libraries I've tried seem to be fully compatible with the libraries it's expecting.
I'm new to Android and GAE development, and as such these problems are daunting to me; I've spent days trying to find a solution. Anybody want to take a crack at this problem? If I do find a solution, I will post it here so anybody else who purchased the book will be able to run this example!
Are you able to run this example on your machine? I'm using Eclipse as my IDE.
I don't know that book and you didn't show the exact code you tried, but the name of the JSON library varies depending on which runtime version (in app.yaml) you use. For Python (== Python 2.5), use simplejson. For Python 2.7, use plain json. The following example straightens out the differences for the rest of your code:
try:
import json
except ImportError:
inport simplejson as json
Now in the rest of your code you can always use json.dumps() and json.loads().
You should include a JAVA JSON library in your web project under under WEB-INF/lib.
Have a look to these libraries:
Jackson
GSON

Categories