How to write RESTful WebServices to Android Application using ZendFramework 2?
The request and response data format is JSON only.
I recomend you to use : Zend Expressive, wich is the micro-framework from Zend, also is compatile with all Zend Framework modules and the most important part, and reason why I use it is because is very similar to Zend Framework 2
Take a look at Apigility, it's a lib to create RESTful API using ZF2:
https://github.com/zfcampus/zf-apigility
Related
I am developing an Android App. I read about RESTful Webservices and decided to use that for my app. But I have doubt about REST Client
After reading many article I understood that
I can directly write code to make HTTP request from android
App as given in Connenting To Network OR
I can write code to develop the RESTful client OR
I can use some already developed Third Party lib like RESTDroid
I am not able to decide should directly write code to make the HTTP request as suggested by developers guide or i should follow the rest client model.
What is the advantage of using rest client over directly making HTTP request ( or can say using non-RESTful Client) ?
I am new to android and REST architecture. Please correct me if I am wrong.
This is quite a broad answer but I will divide it in 2 parts:
1) Rest and non-Rest clients:
In my experience I have not seen any REST client except the browsers
the industry trimmed part of the original REST specification and created improved HTTP clients/services and called them REST which(most of them) are not different than any ordinary HTTP library.
So for Android you will get ordinary HTTP Clients with various features but the REST part you will need to code it yourself.
2) What is better to use
Clearly I would not advise to write your own HTTP client as it is far from trivial job to do.
I would not advise to use Retrofit for a really RESTful service as it is not good for that. You better build something on top of OkHttp or extend Volley or Jus which is my creation and it will support basic HATEOAS implementations from version 0.7.0 and optimized pipeline and memory utilization from version 1.0.0 (follow it on github :)
I have a web written in Django framework and created Rest Framework for the API.
I am required to write an android application based on the Django framework (Android and Django newbie).
However I do not know how to pass the data from android (user input) into database MYSQL through Django Rest Framework. I done a lot of research in past 2 weeks, but still I cannot see any solution (text tutorial, video tutorial, code example) related to this issue.
Note: I will not using any PHP script and looking forward integrate with Django Rest Framework.
Let's have a testing example API from Django : http://json-api.jerel.co/entries
User input field from android: blog, headline, body text, pub date, mod date, authors
Which class/library in android involved? Volley? httpUrl? Json?
I appreciate that anyone can share a simple code to get this done.
======================================================================
FYI,
Database: MYSQL
Server : CentOS
Web : Python - Django
Android : Android studio
============================================================================
After tried all the solutions on net, and excluded those apache http client deprecated post, this is the workable and simplest solution (in my opinion):
https://stackoverflow.com/a/33937147/2466516
Thanks to Nitro.
#chan-hau-yeen, you will want to look at something like Retrofit2 for Android to handle the network post to your Django backend. You can create json objects to post to your backend. Then with django you can accept the json and handle it there.
Once you have created api end points using DRF with data in json . You can use volley library for handling network calls .
Here is the link which shows how make network calls and json parsing .
http://www.androidhive.info/2014/09/android-json-parsing-using-volley/
Here my requirement is getting data from android client and posting those values to the database.Middle level layer is Spring MVC.How to get values from android client to web service? I already have done sample example that is with normal rest web service.I resolved it by using MultivaluedMapping.How to do it in Spring MVC.
Thanks for your valuable suggestions in advance.
Spring Boot makes what you want extremely simple, as 1) it handles most of the configuration automatically (for example it ads Jackson 2 to Spring MVC for seamless JSON handling), 2) it has awesome defaults that meat the needs of RESTFul web services.
Check out the guides section from Spring's site and more specifically the following ones:
1,2,3,4,5
im wondering the easiest way to go about this. I've used retrofit for java before to post and get from endpoints in web service my friend wrote in python.. However I've never wrote server side stuff. I have phpmyadmin running on a vitural server... Havnt used it yet however. I just need people to be able to like or dislike a poem they get from the server. Is there anything on the web I could set up like database I can alter from its endpoint? Or am I going to have to learn php and python now? Thanks guys!
To develop a web service is not necessary use php or python. If you are used to programming in Java I recommend you to use Jersey (https://jersey.java.net/) which offers an easy way to define your endpoints. You can also use jackson (http://jackson.codehaus.org/) to process the json info between client and server. Jackson helps you to transform a collection of object form JSON and vice versa.
I have to write some web services to support some mobile apps (Android and iOS) that our company will be producing. Because we use Windows/IIS servers the services will be based on WCF/.NET 4. I'm wondering what format will be the easiest to use on the mobile end. I know there's JSON, SOAP, and others, I just don't know which has the best support within a mobile environment. Suggestions?
I intend to have a single set of WCF services which are consumed by both mobile platforms.
Since you're using the .NET-platform on the server, WCF supports sending/receiving XML or JSON messages pretty easily using WebHttpBindings and WebServiceHostFactory to build RESTful services.
For the client platforms - you just need an HTTP Client capable of sending JSON or XML formatted messages to a URL and retrieving a response. There are many libraries that will make this easier to manage, but it depends on the complexities involved in your service.
I would avoid SOAP, but you can easily support it using WCF by adding BasicHttpBinding and a ServiceHostFactory.
For my experience, working with JSON is the best way for iOS and Android.
The server... I would use Java (struts or similar).
Hope this helps
I used the Slim framework (PHP) to serve JSON via RESTish URLs, and the GSON library to convert the data, it was pretty straight forward in my case.
I use apache Camel CXF (web service) & to parse the data I use JAXB.
note: about cxf http://camel.apache.org/cxf.html