Development for mobile platforms is usually based on tools already available on other platforms (usually web). Thus, mobile solutions are nothing more than new interfaces for the same application, and because of that there are several pitfalls that you can face, being the largest of all the unnecessary repetition of code.
The problem
I need to make my application available on more than one platform, and I have to rediscover database access code and business rules, which hurts the DRY precept (Don’t Repeat Yourself).
The solution
Through the use of webservices, you can develop only once the negotiating logic of your application, thus making all later platforms only consume the methods of the webservice, reducing your localized application to the development of the interface and the use of APIs
specific (such as access to the device’s camera, for example).
Using webservices, you will have methods that allow you to use the functionality of the application from any platform.
Patterns of webservice
Today we have two main standards for webservices: SOAP
and REST
.
- The architecture
SOAP
is based on the definition of the service from files XML
that provide a description of the methods available in the service. Methods are called by their names (for example, LoginUsuario
);
The architecture REST
is based on the use of HTTP verbs to describe the desired operations, namely:
GET
: recovers resources
POST
: creates new resources
PUT
: fully updates features
PATCH
: partially updates resources
DELETE
: excludes resources
The use of resources in webservices REST
is based specifically on the HTTP method used to invoke the resource along with the parameters. Following the example above, LoginUsuario
could be a requisition GET
under the REST architecture
How to implement
This totally depends on the architecture you are working on. In .net
, a class of webservice REST
has the following syntax:
public class UsuarioController : ApiController
{
// Pode ser invocado com uma requisição GET com dois parâmetros
public string Get(string user, string key)
{
// Operações
}
}
As you are working with Android, I will assume you work with Java
. As I am not familiar with such language, follow some links that can help you:
SOAP webservice in Java
REST webservice in Java
OK, friend I will study, I will use MYSQL+REST IN JAVA thanks
– vandrebr1