Android webservice
-
Upload
alan-echer -
Category
Presentations & Public Speaking
-
view
149 -
download
2
description
Transcript of Android webservice
Comunicação e interação com dispositivos móveis: Android e Web Services
Ministrantes
Alan Carlos EcherGraduado em Sistemas de Informação – FEF
Programador JAVA EE e Androidemail - [email protected]
Luis Fernando CostaGraduado em Sistemas de Informação – FEF
Pós-Graduando Gestão Web – FATECIntegration Specialist - SOA|EXPERT
Programador JAVA EE e Delphiemail - [email protected]
Web service
Web service
Web Services
- SOAP (Simple Object Access Protocol);- XSD (XML Schema Definition);- JAX-WS (Java API for XML Web Services);- WSDL (Web Services Definition Language);- XML (eXtensible Markup Language);- Json (JavaScript Object Notation);- JAX-B (Java Architecture for XML Binding);
SOAP
Simple Object Access Protocol
- Arquivo de comunicação padrão (XML)- Chamada de Procedimento Remoto (RPC)- Protocolo de Transferência de Hipertexto (HTTP)
- FrameworksJAX-WS (Sun)AXIS (Apache)
XSD
XML Schema Definition
JAX-WS
Java API for XML Web Services
import javax.jws.WebService;import javax.jws.WebMethod;import javax.jws.WebParam;
@WebService(serviceName = "WSExemplo") public class WSExemplo {
@WebMethod(operationName = "hello") public String hello(@WebParam(name = "name") String txt) { return "Hello " + txt + " !"; }}
WSDL
Web Services Definition Language
XML (eXtensible Markup Language)
- Linguagem de marcação.
Json (JavaScript Object Notation)
https://code.google.com/p/google-gson/
http://jackson.codehaus.org/
JAX-B
Java Architecture for XML Binding
@XmlRootElement(name = "participante")@XmlType(propOrder = {"id", "nome"})@XmlElement(name = "participante") public List<Participantes> getLista() { return lista; }
- Marshaller
Object > String
- Unmarshaller
String > Object
XML x Json
- XML
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?><participante> <nome>Luis Fernando</nome></participante>
- Json
{"nome":"Luis Fernando"}
Ksoap2
Ksoap2 é uma biblioteca leve para uso em dispositivos limitados, destina-se a comunicar-se com a maioria dos Webservices SOAP.
http://kobjects.org/ksoap2/index.html
XStream
l XStream é uma biblioteca simples para serializar objetos para XML e vice-versa.
l http://xstream.codehaus.org/
Google Play
l Webservice Android Votu
l https://play.google.com/store/apps/details?id=com.webservice.client
Aplicação Exemplo
l Repositório Servidorhttps://bitbucket.org/fyotty/wexemplo
l Repositório Android https://bitbucket.org/alanecher/webservice-android-votu