How do i link android app with web app using REST/HTTP - java

I am new here. I would need some advice on this issue.
I have a well developed java web application deployed on openshift and connected with mySQL.
i am new in android development. Currently, i have to develop an native android application that talks to my openshift application for the data in mySQL. I understand that to do this, i have to create a RESTful web service on my web app and my android application would call the web service.
My questions would be
1. Where can i get started to develop a restful web service, is there any simple-to-understand resources to get me started? I understand that creating a restful web service from scratch would be tedious and having a framework will help in creating a web service better. Please advice me on this
Is there any sample projects/tutorial out there that guide me how to write a restful api to link between my web app and android app?
To create a restful web service, it is using json to parse the information over, is there any guide on this? I'm not very good at json. Would be good if there is an tutorial
Thank you for the guidance in advance! Feeling lost on how to get it started despite reading the getting started on android 1001 times!

If your code is in Java, I suggest you look into Spring MVC framework. Its one of the widely used frameworks for Java.
You could look into Volley examples here.
Volley is recommended for HTTP calls in Android.
To create JSON response to be sent by your server, you could look into Google's GSON library. To parse JSON web response into Java objects in your Android code, you could use any of the ORMs. GreenDAO is a stable open-source library for this purpose.

Related

JavaFX application to expose Webservice

I am new to Web service, and have a JavaFX desktop application running client-side.
I am planning to create an Android application that will call the web service exposed by the desktop application. Any suggestions on how to do this? Tutorial links would be helpful.
I know you are new to webservices, but please go through some documentations first ! You may find a nice tutorial here
A short introduction to Web Services
Just to give you a brief idea on what is wrong with your question. Javafx Desktop application and an android application are both basically clients (who consume web servcies).
You need to have a Server (who exposes web services) hosting a web application, so that these clients can use it. Your webapplication build in java, php, asp etc. The language doesn't matter in case of webservices !

How to make a webservice and connect android application with it

I made an android game. Now i want to store game score of each user in a database.
I am not getting how i can do it, but as far as my findings i need to create a web service for it, where all the functionality for fetching and storing of data.
My questions are:
How to make a web service for fetching and inserting data in DB
how to connect android application to this web service
web service should be in java.
There are so many questions on connecting an Android application to a web service.
If you plan to implement your webservice in Java then I suggest you use the Spring Web Services.
EDIT
Java has two standards for web services: JAX-WS for SOAP web services and JAX-RS for REST web services. Each of these have several implementations. However, I would prefer using the Spring web services.
Also, try reading about Spring from over here.
Hope it helps
Cheers

importing contacts from gmail,yahoo,msn etc from other services using java/j2ee

I am developing a java/j2ee based web app where I am provide a feature to my web app users, where they will be able to get contacts from the different email providers like yahoo gmail and msn and many other services. Since I am building it on java, I found a open source library which is struts 1.2 based application here is the link http://code.google.com/p/socialauth/
here I have to mention that I am using Amazon web services simple emailing service to send out emails using there java api's.
I am novice or I dont knw much about the struts, I am trying to figure out how this struts1.2 based app can be integrated with my servlets or aws, sms java api.
Help me out in this regard
The best API is Smack API. Click Here

Google App Engine (Java) web service authentication/authorization/security

I currently have a Google App Engine app consisting of two parts:
A website using old school JSPs
A RESTful service implemented in Jersey
I've been trying to figure out how to shoehorn authentication into the web service but am rather lost since I've never used Spring before, and it sounds like that's the way to go.
Must I use Spring, or can I use Java EE? Are there any examples of how to accomplish this with Google App Engine?
Also, if I can get a high level description of some best practices for securing web services, that would be cool.
Thanks
Mark
app engine has built in OAuth support, which should do what you want.
I recomend you use apache shiro instead of spring because performance more over if you haven't got experience with spring. Apache shiro is a security framework and it could be integrated with GAE. You also can find a example in githubhow integrate the framework in GAE with Guice library.
Anyway for use Spring in GAE you also can find same best practice on Google Cloud Platform documentation

Creating Java Web Service using Google AppEngine

I'm trying to create a simple web service application where I can retrieve a collection of strings and store them into a data store on the AppEngine server.
I have knowledge in Java and barely any knowledge of Java Servlets and its WAR standards.
I would like to at least have some direction on how to create a web service using the Java technology AppEngine provides. I've searched but the articles are sparse and too lengthy while not providing any simple solutions.
I'd love it if I can create a web service using Java's annotations just like you can do in .NET with attributes.
I'd appreciate links to articles and guidance a full source answer is not required but would be appreciated.
No python based answers please.
IMO, there is no simple solution to build a Web Service on GAE with Java.
But, it's still achievable. Let's start with the Web Services we want to build.
In common usage the term refers to
clients and servers that communicate
over the Hypertext Transfer Protocol
(HTTP) protocol used on the web. Such
services tend to fall into one of two
camps: Big Web Services and
RESTful Web Services.
"Big Web Services" use SOAP/RPC format and RESTful Web Services use REST style one. You can read more about SOAP vs REST.
There are lots of Java open source Web Services frameworks out there. Most of them are generally based on the Java API for XML Web Services (JAX-WS), part of the Java EE platform.
JAX-WS is not supported by Google App Engine as specified in the list Will it play in App Engine. So forget about the "cool Java's annotations".
But, Restlet seems compatible with GAE. So if you think REST could be an option for you, I would go ahead and take a look at the Hello World tutorial of Restlet. Then, I'd go ahead and read the article on how to integrate Restlet with GAE.

Categories