SlideShare a Scribd company logo
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

More Related Content

What's hot

Nodejs presentation
Nodejs presentationNodejs presentation
Nodejs presentation
Arvind Devaraj
 
Java API
Java APIJava API
Android Fragment
Android FragmentAndroid Fragment
Android Fragment
Kan-Han (John) Lu
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
Raghu nath
 
MATERIAL.pdf
MATERIAL.pdfMATERIAL.pdf
MATERIAL.pdf
KattaVenkatesh4
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
Vikash Singh
 
Introduction to fragments in android
Introduction to fragments in androidIntroduction to fragments in android
Introduction to fragments in android
Prawesh Shrestha
 
Low Level View of Android System Architecture
Low Level View of Android System ArchitectureLow Level View of Android System Architecture
Low Level View of Android System Architecture
National Cheng Kung University
 
Java database connectivity
Java database connectivityJava database connectivity
Java database connectivity
Vaishali Modi
 
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxUnit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Malla Reddy University
 
004 - JavaFX Tutorial - Event Handling
004 - JavaFX Tutorial - Event Handling004 - JavaFX Tutorial - Event Handling
004 - JavaFX Tutorial - Event Handling
Mohammad Hossein Rimaz
 
Java Server Pages(jsp)
Java Server Pages(jsp)Java Server Pages(jsp)
Java Server Pages(jsp)
Manisha Keim
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity
Tanmoy Barman
 
Android Services
Android ServicesAndroid Services
Android Services
Ahsanul Karim
 
Android internals By Rajesh Khetan
Android internals By Rajesh KhetanAndroid internals By Rajesh Khetan
Android internals By Rajesh Khetan
Rajesh Khetan
 
Java Programming
Java ProgrammingJava Programming
Java Programming
Elizabeth alexander
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
Aly Abdelkareem
 
Introduction to spring boot
Introduction to spring bootIntroduction to spring boot
Introduction to spring boot
Santosh Kumar Kar
 
An Introduction of Node Package Manager (NPM)
An Introduction of Node Package Manager (NPM)An Introduction of Node Package Manager (NPM)
An Introduction of Node Package Manager (NPM)
iFour Technolab Pvt. Ltd.
 
Android Boot Time Optimization
Android Boot Time OptimizationAndroid Boot Time Optimization
Android Boot Time Optimization
Kan-Ru Chen
 

What's hot (20)

Nodejs presentation
Nodejs presentationNodejs presentation
Nodejs presentation
 
Java API
Java APIJava API
Java API
 
Android Fragment
Android FragmentAndroid Fragment
Android Fragment
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
 
MATERIAL.pdf
MATERIAL.pdfMATERIAL.pdf
MATERIAL.pdf
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Introduction to fragments in android
Introduction to fragments in androidIntroduction to fragments in android
Introduction to fragments in android
 
Low Level View of Android System Architecture
Low Level View of Android System ArchitectureLow Level View of Android System Architecture
Low Level View of Android System Architecture
 
Java database connectivity
Java database connectivityJava database connectivity
Java database connectivity
 
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxUnit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
 
004 - JavaFX Tutorial - Event Handling
004 - JavaFX Tutorial - Event Handling004 - JavaFX Tutorial - Event Handling
004 - JavaFX Tutorial - Event Handling
 
Java Server Pages(jsp)
Java Server Pages(jsp)Java Server Pages(jsp)
Java Server Pages(jsp)
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity
 
Android Services
Android ServicesAndroid Services
Android Services
 
Android internals By Rajesh Khetan
Android internals By Rajesh KhetanAndroid internals By Rajesh Khetan
Android internals By Rajesh Khetan
 
Java Programming
Java ProgrammingJava Programming
Java Programming
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
 
Introduction to spring boot
Introduction to spring bootIntroduction to spring boot
Introduction to spring boot
 
An Introduction of Node Package Manager (NPM)
An Introduction of Node Package Manager (NPM)An Introduction of Node Package Manager (NPM)
An Introduction of Node Package Manager (NPM)
 
Android Boot Time Optimization
Android Boot Time OptimizationAndroid Boot Time Optimization
Android Boot Time Optimization
 

Viewers also liked

Webservice for android ppt
Webservice for android pptWebservice for android ppt
Webservice for android ppt
santosh lamba
 
خدمات الويب (Web Services) و كيف تنشئها
 خدمات الويب (Web Services) و كيف تنشئها  خدمات الويب (Web Services) و كيف تنشئها
خدمات الويب (Web Services) و كيف تنشئها
lunarhalo
 
5 android web_service
5 android web_service5 android web_service
5 android web_service
Saber LAJILI
 
Connecting to Web Services on Android
Connecting to Web Services on AndroidConnecting to Web Services on Android
Connecting to Web Services on Android
sullis
 
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
 
Android Training
Android TrainingAndroid Training
Android Training
Tbldevelopment
 
Web Services - SOAP (part 2)
Web Services - SOAP (part 2)Web Services - SOAP (part 2)
Web Services - SOAP (part 2)
Martin Necasky
 
WS-Addressing
WS-AddressingWS-Addressing
WS-Addressing
Martin Necasky
 
Openerp 8
Openerp 8Openerp 8
Openerp 8
smiste
 
Odoo Module de Fabrication
Odoo Module de FabricationOdoo Module de Fabrication
Odoo Module de Fabrication
Analystik
 
Soa Primer
Soa PrimerSoa Primer
Soa Primer
vavasthi
 
Android fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginnersAndroid fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginners
Boom Shukla
 
Web Services Part 1
Web Services Part 1Web Services Part 1
Web Services Part 1
patinijava
 
OpenERP/Odoo: Fiche Technique
OpenERP/Odoo: Fiche TechniqueOpenERP/Odoo: Fiche Technique
OpenERP/Odoo: Fiche Technique
Africa Performances
 
Atelier1 mise en place d’odoo
Atelier1   mise en place d’odooAtelier1   mise en place d’odoo
Atelier1 mise en place d’odoo
Abdelouahed 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 8
HORIYASOFT
 
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 Odoo
Hassan WAHSISS
 
Android tutorial ppt
Android tutorial pptAndroid tutorial ppt
Android tutorial ppt
Rehna Renu
 

Viewers also liked (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
 

Similar to [Android] Web services

SAX - Android Development
SAX - Android DevelopmentSAX - Android Development
SAX - Android Development
Rafique Mohammed
 
soap toolkit
soap toolkitsoap toolkit
soap toolkit
elliando dias
 
.NET Tutorial
.NET Tutorial.NET Tutorial
.NET Tutorial
mingglelabs
 
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 SERVICE
ijsc
 
dotNETfinal.ppt
dotNETfinal.pptdotNETfinal.ppt
dotNETfinal.ppt
ssuser041880
 
dotNETfinal.ppt
dotNETfinal.pptdotNETfinal.ppt
dotNETfinal.ppt
almkjdfhjjfa
 
Selenium Training in Amritsar
Selenium Training in AmritsarSelenium Training in Amritsar
Selenium Training in Amritsar
E2MATRIX
 
Selenium Training in Jalandhar
Selenium Training in JalandharSelenium Training in Jalandhar
Selenium Training in Jalandhar
E2MATRIX
 
Java script
Java scriptJava script
Java script
19TUIT038KAVIARASUM
 
Selenium Training in Mohali
Selenium Training in MohaliSelenium Training in Mohali
Selenium Training in Mohali
E2MATRIX
 
Selenium Training in Chandigarh
Selenium Training in ChandigarhSelenium Training in Chandigarh
Selenium Training in Chandigarh
E2MATRIX
 
Selenium Training in Ludhiana
Selenium Training in LudhianaSelenium Training in Ludhiana
Selenium Training in Ludhiana
E2MATRIX
 
Top 10 Android Frameworks for Modern.pdf
Top 10 Android Frameworks for Modern.pdfTop 10 Android Frameworks for Modern.pdf
Top 10 Android Frameworks for Modern.pdf
suryamahathi1
 
Best android frameworks for app development in 2023.pdf
Best android frameworks for app development in 2023.pdfBest android frameworks for app development in 2023.pdf
Best android frameworks for app development in 2023.pdf
Laura Miller
 
Selenium Training in Phagwara
Selenium Training in PhagwaraSelenium Training in Phagwara
Selenium Training in Phagwara
E2MATRIX
 
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 Development
Anna Harris
 
Net framework
Net frameworkNet framework
Net framework
jhsri
 
Android OS and application development
Android OS and application developmentAndroid OS and application development
Android OS and application development
Lokesh Kumar
 

Similar to [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
 
Top 10 Android Frameworks for Modern.pdf
Top 10 Android Frameworks for Modern.pdfTop 10 Android Frameworks for Modern.pdf
Top 10 Android Frameworks for Modern.pdf
 
Best android frameworks for app development in 2023.pdf
Best android frameworks for app development in 2023.pdfBest android frameworks for app development in 2023.pdf
Best android frameworks for app development in 2023.pdf
 
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
 

More from Nikmesoft Ltd

[iOS] Networking
[iOS] Networking[iOS] Networking
[iOS] Networking
Nikmesoft Ltd
 
[iOS] Data Storage
[iOS] Data Storage[iOS] Data Storage
[iOS] Data Storage
Nikmesoft Ltd
 
[iOS] Multiple Background Threads
[iOS] Multiple Background Threads[iOS] Multiple Background Threads
[iOS] Multiple Background Threads
Nikmesoft Ltd
 
[iOS] Navigation
[iOS] Navigation[iOS] Navigation
[iOS] Navigation
Nikmesoft Ltd
 
[iOS] Basic UI Elements
[iOS] Basic UI Elements[iOS] Basic UI Elements
[iOS] Basic UI Elements
Nikmesoft Ltd
 
[iOS] Introduction to iOS Programming
[iOS] Introduction to iOS Programming[iOS] Introduction to iOS Programming
[iOS] Introduction to iOS Programming
Nikmesoft Ltd
 
[Android] Multimedia Programming
[Android] Multimedia Programming[Android] Multimedia Programming
[Android] Multimedia Programming
Nikmesoft Ltd
 
[Android] Android Animation
[Android] Android Animation[Android] Android Animation
[Android] Android Animation
Nikmesoft Ltd
 
[Android] 2D Graphics
[Android] 2D Graphics[Android] 2D Graphics
[Android] 2D Graphics
Nikmesoft Ltd
 
[Android] Services and Broadcast Receivers
[Android] Services and Broadcast Receivers[Android] Services and Broadcast Receivers
[Android] Services and Broadcast Receivers
Nikmesoft Ltd
 
[Android] Multiple Background Threads
[Android] Multiple Background Threads[Android] Multiple Background Threads
[Android] Multiple Background Threads
Nikmesoft 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 Services
Nikmesoft Ltd
 
[Android] Data Storage
[Android] Data Storage[Android] Data Storage
[Android] Data Storage
Nikmesoft Ltd
 
[Android] Intent and Activity
[Android] Intent and Activity[Android] Intent and Activity
[Android] Intent and Activity
Nikmesoft Ltd
 
[Android] Widget Event Handling
[Android] Widget Event Handling[Android] Widget Event Handling
[Android] Widget Event Handling
Nikmesoft Ltd
 
[Android] Using Selection Widgets
[Android] Using Selection Widgets[Android] Using Selection Widgets
[Android] Using Selection Widgets
Nikmesoft Ltd
 
[Android] Basic Widgets and Containers
[Android] Basic Widgets and Containers[Android] Basic Widgets and Containers
[Android] Basic Widgets and Containers
Nikmesoft Ltd
 
[Android] Introduction to Android Programming
[Android] Introduction to Android Programming[Android] Introduction to Android Programming
[Android] Introduction to Android Programming
Nikmesoft Ltd
 

More from 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
 

Recently uploaded

DealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 editionDealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 edition
Yevgen Sysoyev
 
20240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 202420240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 2024
Matthew Sinclair
 
Password Rotation in 2024 is still Relevant
Password Rotation in 2024 is still RelevantPassword Rotation in 2024 is still Relevant
Password Rotation in 2024 is still Relevant
Bert Blevins
 
What's New in Copilot for Microsoft365 May 2024.pptx
What's New in Copilot for Microsoft365 May 2024.pptxWhat's New in Copilot for Microsoft365 May 2024.pptx
What's New in Copilot for Microsoft365 May 2024.pptx
Stephanie Beckett
 
find out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challengesfind out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challenges
huseindihon
 
Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024
BookNet Canada
 
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALLBLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
Liveplex
 
Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...
BookNet Canada
 
Advanced Techniques for Cyber Security Analysis and Anomaly Detection
Advanced Techniques for Cyber Security Analysis and Anomaly DetectionAdvanced Techniques for Cyber Security Analysis and Anomaly Detection
Advanced Techniques for Cyber Security Analysis and Anomaly Detection
Bert Blevins
 
Best Programming Language for Civil Engineers
Best Programming Language for Civil EngineersBest Programming Language for Civil Engineers
Best Programming Language for Civil Engineers
Awais Yaseen
 
Choose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presenceChoose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presence
rajancomputerfbd
 
What’s New in Teams Calling, Meetings and Devices May 2024
What’s New in Teams Calling, Meetings and Devices May 2024What’s New in Teams Calling, Meetings and Devices May 2024
What’s New in Teams Calling, Meetings and Devices May 2024
Stephanie Beckett
 
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyyActive Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
RaminGhanbari2
 
Cookies program to display the information though cookie creation
Cookies program to display the information though cookie creationCookies program to display the information though cookie creation
Cookies program to display the information though cookie creation
shanthidl1
 
Pigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdfPigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdf
Pigging Solutions
 
Research Directions for Cross Reality Interfaces
Research Directions for Cross Reality InterfacesResearch Directions for Cross Reality Interfaces
Research Directions for Cross Reality Interfaces
Mark Billinghurst
 
How RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptxHow RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptx
SynapseIndia
 
The Rise of Supernetwork Data Intensive Computing
The Rise of Supernetwork Data Intensive ComputingThe Rise of Supernetwork Data Intensive Computing
The Rise of Supernetwork Data Intensive Computing
Larry Smarr
 
The Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU CampusesThe Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU Campuses
Larry Smarr
 
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
Kief Morris
 

Recently uploaded (20)

DealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 editionDealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 edition
 
20240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 202420240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 2024
 
Password Rotation in 2024 is still Relevant
Password Rotation in 2024 is still RelevantPassword Rotation in 2024 is still Relevant
Password Rotation in 2024 is still Relevant
 
What's New in Copilot for Microsoft365 May 2024.pptx
What's New in Copilot for Microsoft365 May 2024.pptxWhat's New in Copilot for Microsoft365 May 2024.pptx
What's New in Copilot for Microsoft365 May 2024.pptx
 
find out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challengesfind out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challenges
 
Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024
 
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALLBLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
 
Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...
 
Advanced Techniques for Cyber Security Analysis and Anomaly Detection
Advanced Techniques for Cyber Security Analysis and Anomaly DetectionAdvanced Techniques for Cyber Security Analysis and Anomaly Detection
Advanced Techniques for Cyber Security Analysis and Anomaly Detection
 
Best Programming Language for Civil Engineers
Best Programming Language for Civil EngineersBest Programming Language for Civil Engineers
Best Programming Language for Civil Engineers
 
Choose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presenceChoose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presence
 
What’s New in Teams Calling, Meetings and Devices May 2024
What’s New in Teams Calling, Meetings and Devices May 2024What’s New in Teams Calling, Meetings and Devices May 2024
What’s New in Teams Calling, Meetings and Devices May 2024
 
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyyActive Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
 
Cookies program to display the information though cookie creation
Cookies program to display the information though cookie creationCookies program to display the information though cookie creation
Cookies program to display the information though cookie creation
 
Pigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdfPigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdf
 
Research Directions for Cross Reality Interfaces
Research Directions for Cross Reality InterfacesResearch Directions for Cross Reality Interfaces
Research Directions for Cross Reality Interfaces
 
How RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptxHow RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptx
 
The Rise of Supernetwork Data Intensive Computing
The Rise of Supernetwork Data Intensive ComputingThe Rise of Supernetwork Data Intensive Computing
The Rise of Supernetwork Data Intensive Computing
 
The Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU CampusesThe Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU Campuses
 
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
 

[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