SlideShare uma empresa Scribd logo
1 de 37
Android Programming




   Lesson 10

Web services
 NGUYEN The Linh
Android Programming


Contents


      1    Overview

      2    Working with SOAP services

      3    Working with XML

      4    Using KSoap2 Library




                         2
Android Programming


Web services




               Overview




                  3
Android Programming


Overview

 What is a web service?
   A Web service is a method of communication between two
    electronic devices over the World Wide Web.

    The most important factor to the success and popularity of web
     services is the fact that its backbone is XML.




                                 4
Android Programming


Overview

 What is a web service?(cont.)




                          5
Android Programming


Overview

 What is a web service?(cont.)
                   Request -> POST

                        XML

                                       Web
                                     services


                       Response

                         XML
                           6
Android Programming


Web services




        Working with SOAP services




                    7
Android Programming


Working with SOAP services

 What is SOAP?
   SOAP stands for Simple Object Access Protocol

    SOAP is a communication protocol

    SOAP is for communication between applications

    SOAP is a format for sending messages

    SOAP communicates via Internet
                               8
Android Programming


Working with SOAP services

 What is SOAP? (cont.)
   SOAP is platform independent

    SOAP is language independent

    SOAP is based on XML

    SOAP is simple and extensible

    SOAP is a W3C recommendation
                               9
Android Programming


Working with SOAP services

 Why is SOAP Needed?
   It is important for application development to allow Internet
    communication between programs.

     HTTP is supported by all Internet browsers and servers.

     SOAP provides a way to communicate between applications
      running on different operating systems, with different technologies
      and programming languages.


                                  10
Android Programming


Working with SOAP services

 SOAP Building Blocks




                         11
Android Programming


Working with SOAP services

 SOAP Building Blocks (cont.)
    An Envelope element that identifies the XML document as a
     SOAP message.

    A Header element that contains header information.

    A Body element that contains call and response information.




                                12
Android Programming


Working with SOAP services




                   13
Android Programming


Working with SOAP services




                   14
Android Programming


Web services




               Working with XML




                      15
Android Programming


Working with XML

 What is XML?
   XML stands for EXtensible Markup Language
   XML is a markup language much like HTML

    XML was designed to carry data, not to display data
    XML tags are not predefined. You must define your own tags
    XML is designed to be self-descriptive

    XML is a W3C Recommendation


                               16
Android Programming


Working with XML

 What is XML Parser?
   A parser is a piece of program that takes a physical representation
    of some data and converts it into an in-memory form for the
    program as a whole to use.

    Parsers are used everywhere in software.

    An XML Parser is a parser that is designed to read XML and
     create a way for programs to use XML.


                                 17
Android Programming


Working with XML

 The main types of parsers?
    The main types of parsers are known by some names:
       • SAX
       • DOM
       • Pull




                               18
Android Programming


Working with XML

 What is SAX parser?
   A SAX (Simple API for XML) parser does not create any internal
    structure. Instead, it takes the occurrences of components of an
    input document as events, and tells the client what it reads as it
    reads through the input document.

    A SAX parser serves the client application always only with
     pieces of the document at any given time.




                                 19
Android Programming


Working with XML

 What is SAX parser? (cont.)
   A SAX parser, however, is much more space efficient in case of a
    big input document (because it creates no internal structure).
    What’s more, it runs faster and is easier to learn than DOM
    parser because its API is really simple.

    But from the functionality point of view, it provides a fewer
     functions, which means that the users themselves have to take
     care of more, such as creating their own data structures.



                                20
Android Programming


Working with XML




                   21
Android Programming


Working with XML




                   22
Android Programming


Working with XML

 What is DOM parser?
   A DOM (Document Object Model) parser creates a tree structure
    in memory from an input document and then waits for requests
    from client.

    A DOM parser always serves the client application with the entire
     document no matter how much is actually needed by the client.




                                23
Android Programming


Working with XML

 What is DOM parser? (cont.)
   A DOM parser is rich in functionality.

    It creates a DOM tree in memory and allows you to access any
     part of the document repeatedly and allows you to modify the
     DOM tree.

    But it is space inefficient when the document is huge, and it takes
     a little bit longer to learn how to work with it.


                                 24
Android Programming


Working with XML




                   25
Android Programming


Working with XML

 What is Pull parser?
   SAX is a push parser, since it pushes events out to the calling
    application.

    Pull parsers, on the other hand, sit and wait for the application to
     come calling. They ask for the next available event, and the
     application basically loops until it runs out of XML.




                                  26
Android Programming


Working with XML

 What is Pull parser? (cont.)
   Pull parsers are useful in streaming applications, which are areas
    where either the data is too large to fit in memory.

    It is designed to be used with large data sources, and unlike SAX
     which returns every event, the pull parser can choose to skip
     events that it is not interested in.




                                 27
Android Programming


Working with XML




                   28
Android Programming


Working with XML

 What is Pull parser? (cont.)
   The above example will generate the following output:
       •   Start document
       •   Start tag contact
       •   Text Nguyen Van A
       •   End tag contact
       •   End document




                                29
Android Programming


Working with XML

 Example 10.1
    GetLove App
    http://nikmesoft.com/apis/J4FServices/
   index.php




                                30
Android Programming


Web services




           Using KSoap2 Library




                   31
Android Programming


Using KSoap2 Library

 What is KSoap2?
   KSOAP is a SOAP web service client library for constrained
    Java environments such as Applets or J2ME applications (CLDC /
    CDC / MIDP).

    The ksoap2-android project provides a lightweight and efficient
     SOAP client library for the Android platform.

    http://code.google.com/p/ksoap2-android/


                                32
Android Programming


Using KSoap2 Library

 Why is KSoap2 Needed?

  Send
 Request
  (XML)
                       Get
                     Response
                      (XML)

                                  Parsing
                                   XML


                          33
Android Programming


Using KSoap2 Library

 Why is KSoap2 Needed?

  Send
 Request
  (XML)
                       Get
                     Response
                      (XML)

                                  Parsing
                                   XML


                          34
Android Programming


Using KSoap2 Library

 Why is KSoap2 Needed?
                                                Parsing
  Send                                           XML
 Request
                          KSOAP2
  (XML)




              Get
            Response               All In One
             (XML)


                          35
Android Programming


Using KSoap2 Library

 Example 10.2
    Using KSoap2




                       36
Android Programming

Mais conteúdo relacionado

Mais procurados (20)

Lecture 8 Library classes
Lecture 8 Library classesLecture 8 Library classes
Lecture 8 Library classes
 
3.2 javascript regex
3.2 javascript regex3.2 javascript regex
3.2 javascript regex
 
java Servlet technology
java Servlet technologyjava Servlet technology
java Servlet technology
 
Jdbc ppt
Jdbc pptJdbc ppt
Jdbc ppt
 
jQuery
jQueryjQuery
jQuery
 
MULTI THREADING IN JAVA
MULTI THREADING IN JAVAMULTI THREADING IN JAVA
MULTI THREADING IN JAVA
 
Javascript built in String Functions
Javascript built in String FunctionsJavascript built in String Functions
Javascript built in String Functions
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
 
Java and XML
Java and XMLJava and XML
Java and XML
 
Dom(document object model)
Dom(document object model)Dom(document object model)
Dom(document object model)
 
Android Layout.pptx
Android Layout.pptxAndroid Layout.pptx
Android Layout.pptx
 
Android chapter16-web-services
Android chapter16-web-servicesAndroid chapter16-web-services
Android chapter16-web-services
 
Asp.net.
Asp.net.Asp.net.
Asp.net.
 
JSON: The Basics
JSON: The BasicsJSON: The Basics
JSON: The Basics
 
enums
enumsenums
enums
 
Screen orientations in android
Screen orientations in androidScreen orientations in android
Screen orientations in android
 
Java Swing
Java SwingJava Swing
Java Swing
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
WSDL
WSDLWSDL
WSDL
 
Introduction to the Web API
Introduction to the Web APIIntroduction to the Web API
Introduction to the Web API
 

Destaque

Webservice for android ppt
Webservice for android pptWebservice for android ppt
Webservice for android pptsantosh lamba
 
خدمات الويب (Web Services) و كيف تنشئها
 خدمات الويب (Web Services) و كيف تنشئها  خدمات الويب (Web Services) و كيف تنشئها
خدمات الويب (Web Services) و كيف تنشئها lunarhalo
 
5 android web_service
5 android web_service5 android web_service
5 android web_serviceSaber LAJILI
 
Connecting to Web Services on Android
Connecting to Web Services on AndroidConnecting to Web Services on Android
Connecting to Web Services on Androidsullis
 
Preparing your web services for Android and your Android app for web services...
Preparing your web services for Android and your Android app for web services...Preparing your web services for Android and your Android app for web services...
Preparing your web services for Android and your Android app for web services...Droidcon Eastern Europe
 
Web Services - SOAP (part 2)
Web Services - SOAP (part 2)Web Services - SOAP (part 2)
Web Services - SOAP (part 2)Martin Necasky
 
Openerp 8
Openerp 8Openerp 8
Openerp 8smiste
 
Odoo Module de Fabrication
Odoo Module de FabricationOdoo Module de Fabrication
Odoo Module de FabricationAnalystik
 
Soa Primer
Soa PrimerSoa Primer
Soa Primervavasthi
 
Android fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginnersAndroid fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginnersBoom Shukla
 
Web Services Part 1
Web Services Part 1Web Services Part 1
Web Services Part 1patinijava
 
Atelier1 mise en place d’odoo
Atelier1   mise en place d’odooAtelier1   mise en place d’odoo
Atelier1 mise en place d’odooAbdelouahed Abdou
 
Migration gmao de openerp 6.1 vers odoo 8
Migration gmao de openerp 6.1 vers odoo 8Migration gmao de openerp 6.1 vers odoo 8
Migration gmao de openerp 6.1 vers odoo 8HORIYASOFT
 
Atelier2 Odoo: Gestion des Ressources Humaines (installation, employés, contr...
Atelier2 Odoo: Gestion des Ressources Humaines (installation, employés, contr...Atelier2 Odoo: Gestion des Ressources Humaines (installation, employés, contr...
Atelier2 Odoo: Gestion des Ressources Humaines (installation, employés, contr...Abdelouahed Abdou
 
Développement de modules pour odoo (anciennement OpenERP): exemples et exerci...
Développement de modules pour odoo (anciennement OpenERP): exemples et exerci...Développement de modules pour odoo (anciennement OpenERP): exemples et exerci...
Développement de modules pour odoo (anciennement OpenERP): exemples et exerci...Abdelouahed Abdou
 
Python et son intégration avec Odoo
Python et son intégration avec OdooPython et son intégration avec Odoo
Python et son intégration avec OdooHassan WAHSISS
 
Android tutorial ppt
Android tutorial pptAndroid tutorial ppt
Android tutorial pptRehna Renu
 

Destaque (20)

Webservice for android ppt
Webservice for android pptWebservice for android ppt
Webservice for android ppt
 
خدمات الويب (Web Services) و كيف تنشئها
 خدمات الويب (Web Services) و كيف تنشئها  خدمات الويب (Web Services) و كيف تنشئها
خدمات الويب (Web Services) و كيف تنشئها
 
5 android web_service
5 android web_service5 android web_service
5 android web_service
 
Connecting to Web Services on Android
Connecting to Web Services on AndroidConnecting to Web Services on Android
Connecting to Web Services on Android
 
Preparing your web services for Android and your Android app for web services...
Preparing your web services for Android and your Android app for web services...Preparing your web services for Android and your Android app for web services...
Preparing your web services for Android and your Android app for web services...
 
Android Training
Android TrainingAndroid Training
Android Training
 
Web Services - SOAP (part 2)
Web Services - SOAP (part 2)Web Services - SOAP (part 2)
Web Services - SOAP (part 2)
 
WS-Addressing
WS-AddressingWS-Addressing
WS-Addressing
 
Openerp 8
Openerp 8Openerp 8
Openerp 8
 
Odoo Module de Fabrication
Odoo Module de FabricationOdoo Module de Fabrication
Odoo Module de Fabrication
 
Soa Primer
Soa PrimerSoa Primer
Soa Primer
 
Android fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginnersAndroid fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginners
 
Web Services Part 1
Web Services Part 1Web Services Part 1
Web Services Part 1
 
OpenERP/Odoo: Fiche Technique
OpenERP/Odoo: Fiche TechniqueOpenERP/Odoo: Fiche Technique
OpenERP/Odoo: Fiche Technique
 
Atelier1 mise en place d’odoo
Atelier1   mise en place d’odooAtelier1   mise en place d’odoo
Atelier1 mise en place d’odoo
 
Migration gmao de openerp 6.1 vers odoo 8
Migration gmao de openerp 6.1 vers odoo 8Migration gmao de openerp 6.1 vers odoo 8
Migration gmao de openerp 6.1 vers odoo 8
 
Atelier2 Odoo: Gestion des Ressources Humaines (installation, employés, contr...
Atelier2 Odoo: Gestion des Ressources Humaines (installation, employés, contr...Atelier2 Odoo: Gestion des Ressources Humaines (installation, employés, contr...
Atelier2 Odoo: Gestion des Ressources Humaines (installation, employés, contr...
 
Développement de modules pour odoo (anciennement OpenERP): exemples et exerci...
Développement de modules pour odoo (anciennement OpenERP): exemples et exerci...Développement de modules pour odoo (anciennement OpenERP): exemples et exerci...
Développement de modules pour odoo (anciennement OpenERP): exemples et exerci...
 
Python et son intégration avec Odoo
Python et son intégration avec OdooPython et son intégration avec Odoo
Python et son intégration avec Odoo
 
Android tutorial ppt
Android tutorial pptAndroid tutorial ppt
Android tutorial ppt
 

Semelhante a [Android] Web services

Investigating Soap and Xml Technologies in Web Service
Investigating Soap and Xml Technologies in Web Service  Investigating Soap and Xml Technologies in Web Service
Investigating Soap and Xml Technologies in Web Service ijsc
 
INVESTIGATING SOAP AND XML TECHNOLOGIES IN WEB SERVICE
INVESTIGATING SOAP AND XML TECHNOLOGIES IN WEB SERVICEINVESTIGATING SOAP AND XML TECHNOLOGIES IN WEB SERVICE
INVESTIGATING SOAP AND XML TECHNOLOGIES IN WEB SERVICEijsc
 
Selenium Training in Amritsar
Selenium Training in AmritsarSelenium Training in Amritsar
Selenium Training in AmritsarE2MATRIX
 
Selenium Training in Jalandhar
Selenium Training in JalandharSelenium Training in Jalandhar
Selenium Training in JalandharE2MATRIX
 
Selenium Training in Mohali
Selenium Training in MohaliSelenium Training in Mohali
Selenium Training in MohaliE2MATRIX
 
Selenium Training in Chandigarh
Selenium Training in ChandigarhSelenium Training in Chandigarh
Selenium Training in ChandigarhE2MATRIX
 
Selenium Training in Ludhiana
Selenium Training in LudhianaSelenium Training in Ludhiana
Selenium Training in LudhianaE2MATRIX
 
Selenium Training in Phagwara
Selenium Training in PhagwaraSelenium Training in Phagwara
Selenium Training in PhagwaraE2MATRIX
 
Basic of J2EE,WebLogic server,Oracle & Linux
Basic of J2EE,WebLogic server,Oracle & Linux Basic of J2EE,WebLogic server,Oracle & Linux
Basic of J2EE,WebLogic server,Oracle & Linux Aseem Chakrabarthy
 
Technologies Which Can be Helpful for Web Application Development
Technologies Which Can be Helpful for Web Application DevelopmentTechnologies Which Can be Helpful for Web Application Development
Technologies Which Can be Helpful for Web Application DevelopmentAnna Harris
 
Net framework
Net frameworkNet framework
Net frameworkjhsri
 
Android OS and application development
Android OS and application developmentAndroid OS and application development
Android OS and application developmentLokesh Kumar
 
Programming paradigm and web programming
Programming paradigm and web programmingProgramming paradigm and web programming
Programming paradigm and web programmingMohammad Kamrul Hasan
 
Latest Web development technologies 2021
 Latest Web development technologies 2021 Latest Web development technologies 2021
Latest Web development technologies 2021SWATHYSMOHAN
 

Semelhante a [Android] Web services (20)

SAX - Android Development
SAX - Android DevelopmentSAX - Android Development
SAX - Android Development
 
soap toolkit
soap toolkitsoap toolkit
soap toolkit
 
.NET Tutorial
.NET Tutorial.NET Tutorial
.NET Tutorial
 
Investigating Soap and Xml Technologies in Web Service
Investigating Soap and Xml Technologies in Web Service  Investigating Soap and Xml Technologies in Web Service
Investigating Soap and Xml Technologies in Web Service
 
INVESTIGATING SOAP AND XML TECHNOLOGIES IN WEB SERVICE
INVESTIGATING SOAP AND XML TECHNOLOGIES IN WEB SERVICEINVESTIGATING SOAP AND XML TECHNOLOGIES IN WEB SERVICE
INVESTIGATING SOAP AND XML TECHNOLOGIES IN WEB SERVICE
 
dotNETfinal.ppt
dotNETfinal.pptdotNETfinal.ppt
dotNETfinal.ppt
 
dotNETfinal.ppt
dotNETfinal.pptdotNETfinal.ppt
dotNETfinal.ppt
 
Selenium Training in Amritsar
Selenium Training in AmritsarSelenium Training in Amritsar
Selenium Training in Amritsar
 
Selenium Training in Jalandhar
Selenium Training in JalandharSelenium Training in Jalandhar
Selenium Training in Jalandhar
 
Java script
Java scriptJava script
Java script
 
Selenium Training in Mohali
Selenium Training in MohaliSelenium Training in Mohali
Selenium Training in Mohali
 
Selenium Training in Chandigarh
Selenium Training in ChandigarhSelenium Training in Chandigarh
Selenium Training in Chandigarh
 
Selenium Training in Ludhiana
Selenium Training in LudhianaSelenium Training in Ludhiana
Selenium Training in Ludhiana
 
Selenium Training in Phagwara
Selenium Training in PhagwaraSelenium Training in Phagwara
Selenium Training in Phagwara
 
Basic of J2EE,WebLogic server,Oracle & Linux
Basic of J2EE,WebLogic server,Oracle & Linux Basic of J2EE,WebLogic server,Oracle & Linux
Basic of J2EE,WebLogic server,Oracle & Linux
 
Technologies Which Can be Helpful for Web Application Development
Technologies Which Can be Helpful for Web Application DevelopmentTechnologies Which Can be Helpful for Web Application Development
Technologies Which Can be Helpful for Web Application Development
 
Net framework
Net frameworkNet framework
Net framework
 
Android OS and application development
Android OS and application developmentAndroid OS and application development
Android OS and application development
 
Programming paradigm and web programming
Programming paradigm and web programmingProgramming paradigm and web programming
Programming paradigm and web programming
 
Latest Web development technologies 2021
 Latest Web development technologies 2021 Latest Web development technologies 2021
Latest Web development technologies 2021
 

Mais de Nikmesoft Ltd

[iOS] Multiple Background Threads
[iOS] Multiple Background Threads[iOS] Multiple Background Threads
[iOS] Multiple Background ThreadsNikmesoft Ltd
 
[iOS] Basic UI Elements
[iOS] Basic UI Elements[iOS] Basic UI Elements
[iOS] Basic UI ElementsNikmesoft Ltd
 
[iOS] Introduction to iOS Programming
[iOS] Introduction to iOS Programming[iOS] Introduction to iOS Programming
[iOS] Introduction to iOS ProgrammingNikmesoft Ltd
 
[Android] Multimedia Programming
[Android] Multimedia Programming[Android] Multimedia Programming
[Android] Multimedia ProgrammingNikmesoft Ltd
 
[Android] Android Animation
[Android] Android Animation[Android] Android Animation
[Android] Android AnimationNikmesoft Ltd
 
[Android] 2D Graphics
[Android] 2D Graphics[Android] 2D Graphics
[Android] 2D GraphicsNikmesoft Ltd
 
[Android] Services and Broadcast Receivers
[Android] Services and Broadcast Receivers[Android] Services and Broadcast Receivers
[Android] Services and Broadcast ReceiversNikmesoft Ltd
 
[Android] Multiple Background Threads
[Android] Multiple Background Threads[Android] Multiple Background Threads
[Android] Multiple Background ThreadsNikmesoft Ltd
 
[Android] Maps, Geocoding and Location-Based Services
[Android] Maps, Geocoding and Location-Based Services[Android] Maps, Geocoding and Location-Based Services
[Android] Maps, Geocoding and Location-Based ServicesNikmesoft Ltd
 
[Android] Data Storage
[Android] Data Storage[Android] Data Storage
[Android] Data StorageNikmesoft Ltd
 
[Android] Intent and Activity
[Android] Intent and Activity[Android] Intent and Activity
[Android] Intent and ActivityNikmesoft Ltd
 
[Android] Widget Event Handling
[Android] Widget Event Handling[Android] Widget Event Handling
[Android] Widget Event HandlingNikmesoft Ltd
 
[Android] Using Selection Widgets
[Android] Using Selection Widgets[Android] Using Selection Widgets
[Android] Using Selection WidgetsNikmesoft Ltd
 
[Android] Basic Widgets and Containers
[Android] Basic Widgets and Containers[Android] Basic Widgets and Containers
[Android] Basic Widgets and ContainersNikmesoft Ltd
 
[Android] Introduction to Android Programming
[Android] Introduction to Android Programming[Android] Introduction to Android Programming
[Android] Introduction to Android ProgrammingNikmesoft Ltd
 

Mais de Nikmesoft Ltd (18)

[iOS] Networking
[iOS] Networking[iOS] Networking
[iOS] Networking
 
[iOS] Data Storage
[iOS] Data Storage[iOS] Data Storage
[iOS] Data Storage
 
[iOS] Multiple Background Threads
[iOS] Multiple Background Threads[iOS] Multiple Background Threads
[iOS] Multiple Background Threads
 
[iOS] Navigation
[iOS] Navigation[iOS] Navigation
[iOS] Navigation
 
[iOS] Basic UI Elements
[iOS] Basic UI Elements[iOS] Basic UI Elements
[iOS] Basic UI Elements
 
[iOS] Introduction to iOS Programming
[iOS] Introduction to iOS Programming[iOS] Introduction to iOS Programming
[iOS] Introduction to iOS Programming
 
[Android] Multimedia Programming
[Android] Multimedia Programming[Android] Multimedia Programming
[Android] Multimedia Programming
 
[Android] Android Animation
[Android] Android Animation[Android] Android Animation
[Android] Android Animation
 
[Android] 2D Graphics
[Android] 2D Graphics[Android] 2D Graphics
[Android] 2D Graphics
 
[Android] Services and Broadcast Receivers
[Android] Services and Broadcast Receivers[Android] Services and Broadcast Receivers
[Android] Services and Broadcast Receivers
 
[Android] Multiple Background Threads
[Android] Multiple Background Threads[Android] Multiple Background Threads
[Android] Multiple Background Threads
 
[Android] Maps, Geocoding and Location-Based Services
[Android] Maps, Geocoding and Location-Based Services[Android] Maps, Geocoding and Location-Based Services
[Android] Maps, Geocoding and Location-Based Services
 
[Android] Data Storage
[Android] Data Storage[Android] Data Storage
[Android] Data Storage
 
[Android] Intent and Activity
[Android] Intent and Activity[Android] Intent and Activity
[Android] Intent and Activity
 
[Android] Widget Event Handling
[Android] Widget Event Handling[Android] Widget Event Handling
[Android] Widget Event Handling
 
[Android] Using Selection Widgets
[Android] Using Selection Widgets[Android] Using Selection Widgets
[Android] Using Selection Widgets
 
[Android] Basic Widgets and Containers
[Android] Basic Widgets and Containers[Android] Basic Widgets and Containers
[Android] Basic Widgets and Containers
 
[Android] Introduction to Android Programming
[Android] Introduction to Android Programming[Android] Introduction to Android Programming
[Android] Introduction to Android Programming
 

Último

KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostMatt Ray
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Brian Pichman
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...DianaGray10
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPathCommunity
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsSafe Software
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxUdaiappa Ramachandran
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Commit University
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?IES VE
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfAijun Zhang
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDELiveplex
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfDianaGray10
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 

Último (20)

KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptx
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
 
20230104 - machine vision
20230104 - machine vision20230104 - machine vision
20230104 - machine vision
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 

[Android] Web services

  • 1. Android Programming Lesson 10 Web services NGUYEN The Linh
  • 2. Android Programming Contents 1 Overview 2 Working with SOAP services 3 Working with XML 4 Using KSoap2 Library 2
  • 4. Android Programming Overview  What is a web service?  A Web service is a method of communication between two electronic devices over the World Wide Web.  The most important factor to the success and popularity of web services is the fact that its backbone is XML. 4
  • 5. Android Programming Overview  What is a web service?(cont.) 5
  • 6. Android Programming Overview  What is a web service?(cont.) Request -> POST XML Web services Response XML 6
  • 7. Android Programming Web services Working with SOAP services 7
  • 8. Android Programming Working with SOAP services  What is SOAP?  SOAP stands for Simple Object Access Protocol  SOAP is a communication protocol  SOAP is for communication between applications  SOAP is a format for sending messages  SOAP communicates via Internet 8
  • 9. Android Programming Working with SOAP services  What is SOAP? (cont.)  SOAP is platform independent  SOAP is language independent  SOAP is based on XML  SOAP is simple and extensible  SOAP is a W3C recommendation 9
  • 10. Android Programming Working with SOAP services  Why is SOAP Needed?  It is important for application development to allow Internet communication between programs.  HTTP is supported by all Internet browsers and servers.  SOAP provides a way to communicate between applications running on different operating systems, with different technologies and programming languages. 10
  • 11. Android Programming Working with SOAP services  SOAP Building Blocks 11
  • 12. Android Programming Working with SOAP services  SOAP Building Blocks (cont.)  An Envelope element that identifies the XML document as a SOAP message.  A Header element that contains header information.  A Body element that contains call and response information. 12
  • 15. Android Programming Web services Working with XML 15
  • 16. Android Programming Working with XML  What is XML?  XML stands for EXtensible Markup Language  XML is a markup language much like HTML  XML was designed to carry data, not to display data  XML tags are not predefined. You must define your own tags  XML is designed to be self-descriptive  XML is a W3C Recommendation 16
  • 17. Android Programming Working with XML  What is XML Parser?  A parser is a piece of program that takes a physical representation of some data and converts it into an in-memory form for the program as a whole to use.  Parsers are used everywhere in software.  An XML Parser is a parser that is designed to read XML and create a way for programs to use XML. 17
  • 18. Android Programming Working with XML  The main types of parsers?  The main types of parsers are known by some names: • SAX • DOM • Pull 18
  • 19. Android Programming Working with XML  What is SAX parser?  A SAX (Simple API for XML) parser does not create any internal structure. Instead, it takes the occurrences of components of an input document as events, and tells the client what it reads as it reads through the input document.  A SAX parser serves the client application always only with pieces of the document at any given time. 19
  • 20. Android Programming Working with XML  What is SAX parser? (cont.)  A SAX parser, however, is much more space efficient in case of a big input document (because it creates no internal structure). What’s more, it runs faster and is easier to learn than DOM parser because its API is really simple.  But from the functionality point of view, it provides a fewer functions, which means that the users themselves have to take care of more, such as creating their own data structures. 20
  • 23. Android Programming Working with XML  What is DOM parser?  A DOM (Document Object Model) parser creates a tree structure in memory from an input document and then waits for requests from client.  A DOM parser always serves the client application with the entire document no matter how much is actually needed by the client. 23
  • 24. Android Programming Working with XML  What is DOM parser? (cont.)  A DOM parser is rich in functionality.  It creates a DOM tree in memory and allows you to access any part of the document repeatedly and allows you to modify the DOM tree.  But it is space inefficient when the document is huge, and it takes a little bit longer to learn how to work with it. 24
  • 26. Android Programming Working with XML  What is Pull parser?  SAX is a push parser, since it pushes events out to the calling application.  Pull parsers, on the other hand, sit and wait for the application to come calling. They ask for the next available event, and the application basically loops until it runs out of XML. 26
  • 27. Android Programming Working with XML  What is Pull parser? (cont.)  Pull parsers are useful in streaming applications, which are areas where either the data is too large to fit in memory.  It is designed to be used with large data sources, and unlike SAX which returns every event, the pull parser can choose to skip events that it is not interested in. 27
  • 29. Android Programming Working with XML  What is Pull parser? (cont.)  The above example will generate the following output: • Start document • Start tag contact • Text Nguyen Van A • End tag contact • End document 29
  • 30. Android Programming Working with XML  Example 10.1  GetLove App  http://nikmesoft.com/apis/J4FServices/ index.php 30
  • 31. Android Programming Web services Using KSoap2 Library 31
  • 32. Android Programming Using KSoap2 Library  What is KSoap2?  KSOAP is a SOAP web service client library for constrained Java environments such as Applets or J2ME applications (CLDC / CDC / MIDP).  The ksoap2-android project provides a lightweight and efficient SOAP client library for the Android platform.  http://code.google.com/p/ksoap2-android/ 32
  • 33. Android Programming Using KSoap2 Library  Why is KSoap2 Needed? Send Request (XML) Get Response (XML) Parsing XML 33
  • 34. Android Programming Using KSoap2 Library  Why is KSoap2 Needed? Send Request (XML) Get Response (XML) Parsing XML 34
  • 35. Android Programming Using KSoap2 Library  Why is KSoap2 Needed? Parsing Send XML Request KSOAP2 (XML) Get Response All In One (XML) 35
  • 36. Android Programming Using KSoap2 Library  Example 10.2  Using KSoap2 36