SlideShare una empresa de Scribd logo
1 de 15
Servicios WEB
Guido Ticona Hurtado
guidoti@gmail.com
 Sistemas software diseñados para soportar una
interacción interoperable maquina a maquina sobre
una red
 APIs Web que pueden ser accedidas dentro de una
red (principalmente Internet) y son ejecutados en el
sistema que los aloja
 Intercambiar datos entre aplicaciones que no
necesariamente estan en el mismo lenguaje,
sistema operativo o geografia
Smartphone
DBMS
Servidor
HTTPSOAP
REST
WEB
Servicio Web XML
meteorológico
Servicio Web XML
tipo de cambio
Base de datos de
precios de pasajes
Servicio Web XML
precio del pasaje
Seleccionar destino:
La previsión
meteorológica es:
El tipo de cambio es:
El pasaje de avión sólo cuesta:
Lluvia
China
$1.56
$1,999.98
Sitio de viajes
AquiNoMeQuedo.com
Internet
 Remote Procedure Calls (RPC, Llamadas a
Procedimientos Remotos)
 REST
 SOAP
 Es una técnica de arquitectura software para
sistemas hipermedia distribuidos como la
World Wide Web
 Se usa en el sentido más amplio para
describir cualquier interfaz web simple que
utiliza XML y HTTP, sin las abstracciones
adicionales de los protocolos basados en
patrones de intercambio de mensajes como
el protocolo de servicios web SOAP
 Trabajan con HTTP e implementan
operaciones basicas GET POST
 Se centra más en interactuar con
recursos con estado, que con
mensajes y operaciones
 HttpClient httpClient = new DefaultHttpClient();
 HttpGet get =new HttpGet(URI);
 get.setHeader("content-type", "application/json");
 HttpResponse resp = httpClient.execute(get);
 String respStr = EntityUtils.toString(resp.getEntity());
 JSONArray respJSON = new JSONArray(respStr);
 for(int i=0; i<respJSON.length(); i++)
 JSONObject obj = respJSON.getJSONObject(i);
 int id = obj.getInt("id");
 String nombre= obj.getString("nombre");
 HttpClient httpClient = new DefaultHttpClient();
 HttpGet get =new HttpGet(URI);
 get.setHeader("content-type", "application/json");
 HttpResponse resp = httpClient.execute(get);
 String respStr = EntityUtils.toString(resp.getEntity());
 JSONObject respJSON = new JSONObject(respStr);
 int idd = respJSON.getInt("id");
 String nombre = respJSON.getString("nombre");
 String apellido = respJSON.getString("apellido");
 HttpClient httpClient = new DefaultHttpClient();
 HttpDelete del = new HttpDelete(“URI);
 del.setHeader("content-type", "application/json");
 HttpResponse resp = httpClient.execute(del);
 String respStr = EntityUtils.toString(resp.getEntity());
 HttpClient httpClient = new DefaultHttpClient();
 HttpPost post = new HttpPost(URI);
 post.setHeader("content-type", "application/json");
 JSONObject dato = new JSONObject();
 dato.put("nombre",””);
 StringEntity entity = new StringEntity(dato.toString());
 post.setEntity(entity);
 HttpResponse resp = httpClient.execute(post);
 String respStr = EntityUtils.toString(resp.getEntity());
 JSONObject respJSON = new JSONObject(respStr);
 HttpClient httpClient = new DefaultHttpClient();
 HttpPut put = new HttpPut(URI);
 put.setHeader("content-type", "application/json");
 JSONObject dato = new JSONObject();
 dato.put("id", txtId.getText().toString());
 dato.put("nombre", txtNombre.getText().toString());
 StringEntity entity = new StringEntity(dato.toString());
 put.setEntity(entity);
 HttpResponse resp = httpClient.execute(put);
 String respStr = EntityUtils.toString(resp.getEntity());
 Esto es típicamente referenciado como servicios orientados a
mensajes
 Los Servicios Web pueden también ser implementados
siguiendo los conceptos de la arquitectura SOA, donde la
unidad básica de comunicación es el mensaje, más que la
operación
 Es débilmente acoplado
 SoapObject request = new SoapObject(NAMESPACE,METHOD_NAME);
 SoapSerializationEnvelope envelope = new
SoapSerializationEnvelope(SoapEnvelope.VER11);
 envelope.dotNet = true;
 envelope.setOutputSoapObject(request);
 HttpTransportSE transporte = new HttpTransportSE(URL);
 transporte.call(SOAP_ACTION, envelope);
 SoapObject resSoap =(SoapObject)envelope.getResponse();
 for (int i = 0; i < resSoap.getPropertyCount(); i++)
 SoapObject ic = (SoapObject)resSoap.getProperty(i);
 cli.id = Integer.parseInt(ic.getProperty(0).toString());
 cli.nombre = ic.getProperty(1).toString();
 SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
 request.addProperty("nombre","nombre");
 SoapSerializationEnvelope envelope = new
SoapSerializationEnvelope(SoapEnvelope.VER11);
 envelope.dotNet = true;
 envelope.setOutputSoapObject(request);
 HttpTransportSE transporte = new HttpTransportSE(URL);
 transporte.call(SOAP_ACTION, envelope);
 SoapPrimitive resuSOAP =(SoapPrimitive)envelope.getResponse();

Más contenido relacionado

La actualidad más candente

Framework .NET 3.5 13 Programación orientada a la red
Framework .NET 3.5 13 Programación orientada a la redFramework .NET 3.5 13 Programación orientada a la red
Framework .NET 3.5 13 Programación orientada a la redAntonio Palomares Sender
 
Java Primeros Pasos Revista- Edición 2
Java Primeros Pasos Revista- Edición 2Java Primeros Pasos Revista- Edición 2
Java Primeros Pasos Revista- Edición 2guest39ff1b
 
Ser vlet conectar con base de datos
Ser vlet conectar con base de datosSer vlet conectar con base de datos
Ser vlet conectar con base de datosDavid
 
Explicación del código del Servlet HolaMundo
Explicación del código del Servlet HolaMundoExplicación del código del Servlet HolaMundo
Explicación del código del Servlet HolaMundojubacalo
 
Desarrollando un API con REST
Desarrollando un API con RESTDesarrollando un API con REST
Desarrollando un API con RESTAlex Puig
 
Servlet Hola Mundo con Eclipse y Tomcat
Servlet Hola Mundo con Eclipse y TomcatServlet Hola Mundo con Eclipse y Tomcat
Servlet Hola Mundo con Eclipse y Tomcatjubacalo
 
Web services restful con JAX-RS
Web services restful con JAX-RSWeb services restful con JAX-RS
Web services restful con JAX-RSVortexbird
 
Servicios Rest con Jersey
Servicios Rest con Jersey Servicios Rest con Jersey
Servicios Rest con Jersey Vortexbird
 
Desarrollando con APIs
Desarrollando con APIsDesarrollando con APIs
Desarrollando con APIsArturo Garrido
 
Toturial aplicacion base de datos jsp
Toturial aplicacion base de datos jspToturial aplicacion base de datos jsp
Toturial aplicacion base de datos jspGabriela Vazquez
 
SEMINARIO: Servicios REST. Bases de la tecnología y soporte con Spring MVC
SEMINARIO: Servicios REST. Bases de la tecnología y soporte con Spring MVCSEMINARIO: Servicios REST. Bases de la tecnología y soporte con Spring MVC
SEMINARIO: Servicios REST. Bases de la tecnología y soporte con Spring MVCParadigma Digital
 
Semana 1 tecnologias web
Semana 1   tecnologias webSemana 1   tecnologias web
Semana 1 tecnologias webINFOVIC
 
Servicios Web Rest con Spring MVC
Servicios Web Rest con Spring MVCServicios Web Rest con Spring MVC
Servicios Web Rest con Spring MVCVortexbird
 
Clase 10 validacion
Clase 10   validacionClase 10   validacion
Clase 10 validacionhydras_cs
 
Clase 13 seguridad
Clase 13   seguridad Clase 13   seguridad
Clase 13 seguridad hydras_cs
 
Presentación Multimedia - HTML5
Presentación Multimedia - HTML5Presentación Multimedia - HTML5
Presentación Multimedia - HTML5Viviana Trujillo
 

La actualidad más candente (20)

Framework .NET 3.5 13 Programación orientada a la red
Framework .NET 3.5 13 Programación orientada a la redFramework .NET 3.5 13 Programación orientada a la red
Framework .NET 3.5 13 Programación orientada a la red
 
Java Primeros Pasos Revista- Edición 2
Java Primeros Pasos Revista- Edición 2Java Primeros Pasos Revista- Edición 2
Java Primeros Pasos Revista- Edición 2
 
Ser vlet conectar con base de datos
Ser vlet conectar con base de datosSer vlet conectar con base de datos
Ser vlet conectar con base de datos
 
Explicación del código del Servlet HolaMundo
Explicación del código del Servlet HolaMundoExplicación del código del Servlet HolaMundo
Explicación del código del Servlet HolaMundo
 
Desarrollando un API con REST
Desarrollando un API con RESTDesarrollando un API con REST
Desarrollando un API con REST
 
Servlet Hola Mundo con Eclipse y Tomcat
Servlet Hola Mundo con Eclipse y TomcatServlet Hola Mundo con Eclipse y Tomcat
Servlet Hola Mundo con Eclipse y Tomcat
 
Web services restful con JAX-RS
Web services restful con JAX-RSWeb services restful con JAX-RS
Web services restful con JAX-RS
 
Introducción a REST - SymfonyVLC
Introducción a REST - SymfonyVLCIntroducción a REST - SymfonyVLC
Introducción a REST - SymfonyVLC
 
Ajax Huancayo
Ajax HuancayoAjax Huancayo
Ajax Huancayo
 
Servicios Rest con Jersey
Servicios Rest con Jersey Servicios Rest con Jersey
Servicios Rest con Jersey
 
Desarrollando con APIs
Desarrollando con APIsDesarrollando con APIs
Desarrollando con APIs
 
Toturial aplicacion base de datos jsp
Toturial aplicacion base de datos jspToturial aplicacion base de datos jsp
Toturial aplicacion base de datos jsp
 
SEMINARIO: Servicios REST. Bases de la tecnología y soporte con Spring MVC
SEMINARIO: Servicios REST. Bases de la tecnología y soporte con Spring MVCSEMINARIO: Servicios REST. Bases de la tecnología y soporte con Spring MVC
SEMINARIO: Servicios REST. Bases de la tecnología y soporte con Spring MVC
 
Semana 1 tecnologias web
Semana 1   tecnologias webSemana 1   tecnologias web
Semana 1 tecnologias web
 
Servicios Web Rest con Spring MVC
Servicios Web Rest con Spring MVCServicios Web Rest con Spring MVC
Servicios Web Rest con Spring MVC
 
Curso Jsp Mas
Curso Jsp MasCurso Jsp Mas
Curso Jsp Mas
 
Clase 10 validacion
Clase 10   validacionClase 10   validacion
Clase 10 validacion
 
Servicios web
Servicios webServicios web
Servicios web
 
Clase 13 seguridad
Clase 13   seguridad Clase 13   seguridad
Clase 13 seguridad
 
Presentación Multimedia - HTML5
Presentación Multimedia - HTML5Presentación Multimedia - HTML5
Presentación Multimedia - HTML5
 

Destacado

Netflix Presentation - George's
Netflix Presentation - George'sNetflix Presentation - George's
Netflix Presentation - George'sGeorge Ferko
 
AS Macro Revision Aggregate Demand
AS Macro Revision Aggregate DemandAS Macro Revision Aggregate Demand
AS Macro Revision Aggregate Demandtutor2u
 
Plan anual de trabajo aip-2016
Plan anual de trabajo aip-2016Plan anual de trabajo aip-2016
Plan anual de trabajo aip-2016José Luis Ortiz
 
AS Macro Revision Aspects of the Economic Cycle
AS Macro Revision Aspects of the Economic CycleAS Macro Revision Aspects of the Economic Cycle
AS Macro Revision Aspects of the Economic Cycletutor2u
 
Production & operations management
Production & operations managementProduction & operations management
Production & operations managementshart sood
 

Destacado (8)

Netflix Presentation - George's
Netflix Presentation - George'sNetflix Presentation - George's
Netflix Presentation - George's
 
UROP Poster
UROP PosterUROP Poster
UROP Poster
 
Xiaomi inc.
Xiaomi inc.Xiaomi inc.
Xiaomi inc.
 
Larong Pinoy Advocacy & Community Engagement
Larong Pinoy Advocacy & Community EngagementLarong Pinoy Advocacy & Community Engagement
Larong Pinoy Advocacy & Community Engagement
 
AS Macro Revision Aggregate Demand
AS Macro Revision Aggregate DemandAS Macro Revision Aggregate Demand
AS Macro Revision Aggregate Demand
 
Plan anual de trabajo aip-2016
Plan anual de trabajo aip-2016Plan anual de trabajo aip-2016
Plan anual de trabajo aip-2016
 
AS Macro Revision Aspects of the Economic Cycle
AS Macro Revision Aspects of the Economic CycleAS Macro Revision Aspects of the Economic Cycle
AS Macro Revision Aspects of the Economic Cycle
 
Production & operations management
Production & operations managementProduction & operations management
Production & operations management
 

Similar a 12.android servicios web

Similar a 12.android servicios web (20)

Servicios web
Servicios webServicios web
Servicios web
 
Servicios web
Servicios webServicios web
Servicios web
 
7. Utilización de mecanismos de comunicación asíncrona
7. Utilización de mecanismos de comunicación asíncrona7. Utilización de mecanismos de comunicación asíncrona
7. Utilización de mecanismos de comunicación asíncrona
 
Presentacion ajax
Presentacion   ajaxPresentacion   ajax
Presentacion ajax
 
Introduction AJAX
Introduction AJAXIntroduction AJAX
Introduction AJAX
 
Conceptos Introductorios Del Web 2
Conceptos Introductorios Del Web 2Conceptos Introductorios Del Web 2
Conceptos Introductorios Del Web 2
 
Conceptos acerca de Ajax
Conceptos acerca  de AjaxConceptos acerca  de Ajax
Conceptos acerca de Ajax
 
Introduccion Ajax V1.0
Introduccion Ajax V1.0Introduccion Ajax V1.0
Introduccion Ajax V1.0
 
01 Ext Js Introduccion
01 Ext Js   Introduccion01 Ext Js   Introduccion
01 Ext Js Introduccion
 
Novedades en Desarrollo en SharePoint 2013
Novedades en Desarrollo en SharePoint 2013Novedades en Desarrollo en SharePoint 2013
Novedades en Desarrollo en SharePoint 2013
 
Desarrollo web2
Desarrollo web2Desarrollo web2
Desarrollo web2
 
Real time
Real timeReal time
Real time
 
10. consumiendo datos
10. consumiendo datos10. consumiendo datos
10. consumiendo datos
 
Aplicación Cliente - Servidor / GUI - Consola
Aplicación Cliente - Servidor / GUI - ConsolaAplicación Cliente - Servidor / GUI - Consola
Aplicación Cliente - Servidor / GUI - Consola
 
Servicios Web
Servicios WebServicios Web
Servicios Web
 
PHP+Ajax
PHP+AjaxPHP+Ajax
PHP+Ajax
 
BlackBerry DevCon 2011 - COM34
BlackBerry DevCon 2011 - COM34BlackBerry DevCon 2011 - COM34
BlackBerry DevCon 2011 - COM34
 
AJAX a cuerda Lo básico sobre AJAX y su funcionamiento
AJAX a cuerda
Lo básico sobre AJAX y su funcionamientoAJAX a cuerda
Lo básico sobre AJAX y su funcionamiento
AJAX a cuerda Lo básico sobre AJAX y su funcionamiento
 
Clase 5 AJAX - Desarrollo de aplicaciones móviles
Clase 5  AJAX - Desarrollo de aplicaciones móvilesClase 5  AJAX - Desarrollo de aplicaciones móviles
Clase 5 AJAX - Desarrollo de aplicaciones móviles
 
Base de datos moviles
Base de datos movilesBase de datos moviles
Base de datos moviles
 

Más de guidotic

1 Programación Web con .NET y C#
1 Programación Web con .NET y C#1 Programación Web con .NET y C#
1 Programación Web con .NET y C#guidotic
 
15 Programación Web con .NET y C#
15 Programación Web con .NET y C#15 Programación Web con .NET y C#
15 Programación Web con .NET y C#guidotic
 
14 Programación Web con .NET y C#
14 Programación Web con .NET y C#14 Programación Web con .NET y C#
14 Programación Web con .NET y C#guidotic
 
13 Programación Web con .NET y C#
13 Programación Web con .NET y C#13 Programación Web con .NET y C#
13 Programación Web con .NET y C#guidotic
 
12 Programación Web con .NET y C#
12 Programación Web con .NET y C#12 Programación Web con .NET y C#
12 Programación Web con .NET y C#guidotic
 
11 Programación Web con .NET y C#
11 Programación Web con .NET y C#11 Programación Web con .NET y C#
11 Programación Web con .NET y C#guidotic
 
10 Programación Web con .NET y C#
10 Programación Web con .NET y C#10 Programación Web con .NET y C#
10 Programación Web con .NET y C#guidotic
 
9 Programación Web con .NET y C#
9 Programación Web con .NET y C#9 Programación Web con .NET y C#
9 Programación Web con .NET y C#guidotic
 
8 Programación Web con .NET y C#
8 Programación Web con .NET y C#8 Programación Web con .NET y C#
8 Programación Web con .NET y C#guidotic
 
7 Programación Web con .NET y C#
7 Programación Web con .NET y C#7 Programación Web con .NET y C#
7 Programación Web con .NET y C#guidotic
 
6 Programación Web con .NET y C#
6 Programación Web con .NET y C#6 Programación Web con .NET y C#
6 Programación Web con .NET y C#guidotic
 
5 Programación Web con .NET y C#
5 Programación Web con .NET y C#5 Programación Web con .NET y C#
5 Programación Web con .NET y C#guidotic
 
4 Programación Web con .NET y C#
4 Programación Web con .NET y C#4 Programación Web con .NET y C#
4 Programación Web con .NET y C#guidotic
 
5 Administración Android - Activity Manager
5 Administración Android  -  Activity Manager5 Administración Android  -  Activity Manager
5 Administración Android - Activity Managerguidotic
 
4 Administración Android - ADB 2
4 Administración Android - ADB 24 Administración Android - ADB 2
4 Administración Android - ADB 2guidotic
 
3 Administración Android - ADB
3 Administración Android  -  ADB3 Administración Android  -  ADB
3 Administración Android - ADBguidotic
 
2 Administración Android - Android
2 Administración Android  -  Android2 Administración Android  -  Android
2 Administración Android - Androidguidotic
 
1 Administración Android - Introducción
1 Administración Android -  Introducción1 Administración Android -  Introducción
1 Administración Android - Introducciónguidotic
 
16 Administración Android - EMM
16 Administración Android  -  EMM16 Administración Android  -  EMM
16 Administración Android - EMMguidotic
 
15 Administración Android - Localizacion
15 Administración Android  -  Localizacion15 Administración Android  -  Localizacion
15 Administración Android - Localizacionguidotic
 

Más de guidotic (20)

1 Programación Web con .NET y C#
1 Programación Web con .NET y C#1 Programación Web con .NET y C#
1 Programación Web con .NET y C#
 
15 Programación Web con .NET y C#
15 Programación Web con .NET y C#15 Programación Web con .NET y C#
15 Programación Web con .NET y C#
 
14 Programación Web con .NET y C#
14 Programación Web con .NET y C#14 Programación Web con .NET y C#
14 Programación Web con .NET y C#
 
13 Programación Web con .NET y C#
13 Programación Web con .NET y C#13 Programación Web con .NET y C#
13 Programación Web con .NET y C#
 
12 Programación Web con .NET y C#
12 Programación Web con .NET y C#12 Programación Web con .NET y C#
12 Programación Web con .NET y C#
 
11 Programación Web con .NET y C#
11 Programación Web con .NET y C#11 Programación Web con .NET y C#
11 Programación Web con .NET y C#
 
10 Programación Web con .NET y C#
10 Programación Web con .NET y C#10 Programación Web con .NET y C#
10 Programación Web con .NET y C#
 
9 Programación Web con .NET y C#
9 Programación Web con .NET y C#9 Programación Web con .NET y C#
9 Programación Web con .NET y C#
 
8 Programación Web con .NET y C#
8 Programación Web con .NET y C#8 Programación Web con .NET y C#
8 Programación Web con .NET y C#
 
7 Programación Web con .NET y C#
7 Programación Web con .NET y C#7 Programación Web con .NET y C#
7 Programación Web con .NET y C#
 
6 Programación Web con .NET y C#
6 Programación Web con .NET y C#6 Programación Web con .NET y C#
6 Programación Web con .NET y C#
 
5 Programación Web con .NET y C#
5 Programación Web con .NET y C#5 Programación Web con .NET y C#
5 Programación Web con .NET y C#
 
4 Programación Web con .NET y C#
4 Programación Web con .NET y C#4 Programación Web con .NET y C#
4 Programación Web con .NET y C#
 
5 Administración Android - Activity Manager
5 Administración Android  -  Activity Manager5 Administración Android  -  Activity Manager
5 Administración Android - Activity Manager
 
4 Administración Android - ADB 2
4 Administración Android - ADB 24 Administración Android - ADB 2
4 Administración Android - ADB 2
 
3 Administración Android - ADB
3 Administración Android  -  ADB3 Administración Android  -  ADB
3 Administración Android - ADB
 
2 Administración Android - Android
2 Administración Android  -  Android2 Administración Android  -  Android
2 Administración Android - Android
 
1 Administración Android - Introducción
1 Administración Android -  Introducción1 Administración Android -  Introducción
1 Administración Android - Introducción
 
16 Administración Android - EMM
16 Administración Android  -  EMM16 Administración Android  -  EMM
16 Administración Android - EMM
 
15 Administración Android - Localizacion
15 Administración Android  -  Localizacion15 Administración Android  -  Localizacion
15 Administración Android - Localizacion
 

12.android servicios web

  • 1. Servicios WEB Guido Ticona Hurtado guidoti@gmail.com
  • 2.  Sistemas software diseñados para soportar una interacción interoperable maquina a maquina sobre una red  APIs Web que pueden ser accedidas dentro de una red (principalmente Internet) y son ejecutados en el sistema que los aloja  Intercambiar datos entre aplicaciones que no necesariamente estan en el mismo lenguaje, sistema operativo o geografia
  • 4. Servicio Web XML meteorológico Servicio Web XML tipo de cambio Base de datos de precios de pasajes Servicio Web XML precio del pasaje Seleccionar destino: La previsión meteorológica es: El tipo de cambio es: El pasaje de avión sólo cuesta: Lluvia China $1.56 $1,999.98 Sitio de viajes AquiNoMeQuedo.com Internet
  • 5.  Remote Procedure Calls (RPC, Llamadas a Procedimientos Remotos)  REST  SOAP
  • 6.  Es una técnica de arquitectura software para sistemas hipermedia distribuidos como la World Wide Web  Se usa en el sentido más amplio para describir cualquier interfaz web simple que utiliza XML y HTTP, sin las abstracciones adicionales de los protocolos basados en patrones de intercambio de mensajes como el protocolo de servicios web SOAP
  • 7.  Trabajan con HTTP e implementan operaciones basicas GET POST  Se centra más en interactuar con recursos con estado, que con mensajes y operaciones
  • 8.  HttpClient httpClient = new DefaultHttpClient();  HttpGet get =new HttpGet(URI);  get.setHeader("content-type", "application/json");  HttpResponse resp = httpClient.execute(get);  String respStr = EntityUtils.toString(resp.getEntity());  JSONArray respJSON = new JSONArray(respStr);  for(int i=0; i<respJSON.length(); i++)  JSONObject obj = respJSON.getJSONObject(i);  int id = obj.getInt("id");  String nombre= obj.getString("nombre");
  • 9.  HttpClient httpClient = new DefaultHttpClient();  HttpGet get =new HttpGet(URI);  get.setHeader("content-type", "application/json");  HttpResponse resp = httpClient.execute(get);  String respStr = EntityUtils.toString(resp.getEntity());  JSONObject respJSON = new JSONObject(respStr);  int idd = respJSON.getInt("id");  String nombre = respJSON.getString("nombre");  String apellido = respJSON.getString("apellido");
  • 10.  HttpClient httpClient = new DefaultHttpClient();  HttpDelete del = new HttpDelete(“URI);  del.setHeader("content-type", "application/json");  HttpResponse resp = httpClient.execute(del);  String respStr = EntityUtils.toString(resp.getEntity());
  • 11.  HttpClient httpClient = new DefaultHttpClient();  HttpPost post = new HttpPost(URI);  post.setHeader("content-type", "application/json");  JSONObject dato = new JSONObject();  dato.put("nombre",””);  StringEntity entity = new StringEntity(dato.toString());  post.setEntity(entity);  HttpResponse resp = httpClient.execute(post);  String respStr = EntityUtils.toString(resp.getEntity());  JSONObject respJSON = new JSONObject(respStr);
  • 12.  HttpClient httpClient = new DefaultHttpClient();  HttpPut put = new HttpPut(URI);  put.setHeader("content-type", "application/json");  JSONObject dato = new JSONObject();  dato.put("id", txtId.getText().toString());  dato.put("nombre", txtNombre.getText().toString());  StringEntity entity = new StringEntity(dato.toString());  put.setEntity(entity);  HttpResponse resp = httpClient.execute(put);  String respStr = EntityUtils.toString(resp.getEntity());
  • 13.  Esto es típicamente referenciado como servicios orientados a mensajes  Los Servicios Web pueden también ser implementados siguiendo los conceptos de la arquitectura SOA, donde la unidad básica de comunicación es el mensaje, más que la operación  Es débilmente acoplado
  • 14.  SoapObject request = new SoapObject(NAMESPACE,METHOD_NAME);  SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);  envelope.dotNet = true;  envelope.setOutputSoapObject(request);  HttpTransportSE transporte = new HttpTransportSE(URL);  transporte.call(SOAP_ACTION, envelope);  SoapObject resSoap =(SoapObject)envelope.getResponse();  for (int i = 0; i < resSoap.getPropertyCount(); i++)  SoapObject ic = (SoapObject)resSoap.getProperty(i);  cli.id = Integer.parseInt(ic.getProperty(0).toString());  cli.nombre = ic.getProperty(1).toString();
  • 15.  SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);  request.addProperty("nombre","nombre");  SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);  envelope.dotNet = true;  envelope.setOutputSoapObject(request);  HttpTransportSE transporte = new HttpTransportSE(URL);  transporte.call(SOAP_ACTION, envelope);  SoapPrimitive resuSOAP =(SoapPrimitive)envelope.getResponse();