SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

Layouts in android
Layouts in androidLayouts in android
Layouts in androidDurai S
 
JRE , JDK and platform independent nature of JAVA
JRE , JDK and platform independent nature of JAVAJRE , JDK and platform independent nature of JAVA
JRE , JDK and platform independent nature of JAVAMehak Tawakley
 
Introduction to MERN Stack
Introduction to MERN StackIntroduction to MERN Stack
Introduction to MERN StackSurya937648
 
Android architecture
Android architectureAndroid architecture
Android architecturepoojapainter
 
C# Framework class library
C# Framework class libraryC# Framework class library
C# Framework class libraryPrem Kumar Badri
 
Eclipse introduction IDE PRESENTATION
Eclipse introduction IDE PRESENTATIONEclipse introduction IDE PRESENTATION
Eclipse introduction IDE PRESENTATIONAYESHA JAVED
 
Java Lambda Expressions.pptx
Java Lambda Expressions.pptxJava Lambda Expressions.pptx
Java Lambda Expressions.pptxSameerAhmed593310
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivityTanmoy Barman
 
servlet in java
servlet in javaservlet in java
servlet in javasowfi
 
Lecture 1 introduction to vb.net
Lecture 1   introduction to vb.netLecture 1   introduction to vb.net
Lecture 1 introduction to vb.netMUKALU STEVEN
 
Introduction to Spring Framework and Spring IoC
Introduction to Spring Framework and Spring IoCIntroduction to Spring Framework and Spring IoC
Introduction to Spring Framework and Spring IoCFunnelll
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsVikash Singh
 
The Evolution of Java
The Evolution of JavaThe Evolution of Java
The Evolution of JavaFu Cheng
 
Content provider in_android
Content provider in_androidContent provider in_android
Content provider in_androidPRITI TELMORE
 

Tendances (20)

Jdbc ppt
Jdbc pptJdbc ppt
Jdbc ppt
 
Layouts in android
Layouts in androidLayouts in android
Layouts in android
 
JRE , JDK and platform independent nature of JAVA
JRE , JDK and platform independent nature of JAVAJRE , JDK and platform independent nature of JAVA
JRE , JDK and platform independent nature of JAVA
 
Introduction to MERN Stack
Introduction to MERN StackIntroduction to MERN Stack
Introduction to MERN Stack
 
Java Streams
Java StreamsJava Streams
Java Streams
 
Android architecture
Android architectureAndroid architecture
Android architecture
 
C# Framework class library
C# Framework class libraryC# Framework class library
C# Framework class library
 
Eclipse introduction IDE PRESENTATION
Eclipse introduction IDE PRESENTATIONEclipse introduction IDE PRESENTATION
Eclipse introduction IDE PRESENTATION
 
Java Lambda Expressions.pptx
Java Lambda Expressions.pptxJava Lambda Expressions.pptx
Java Lambda Expressions.pptx
 
Web api
Web apiWeb api
Web api
 
C#.NET
C#.NETC#.NET
C#.NET
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity
 
Angular overview
Angular overviewAngular overview
Angular overview
 
servlet in java
servlet in javaservlet in java
servlet in java
 
ASP.NET Web form
ASP.NET Web formASP.NET Web form
ASP.NET Web form
 
Lecture 1 introduction to vb.net
Lecture 1   introduction to vb.netLecture 1   introduction to vb.net
Lecture 1 introduction to vb.net
 
Introduction to Spring Framework and Spring IoC
Introduction to Spring Framework and Spring IoCIntroduction to Spring Framework and Spring IoC
Introduction to Spring Framework and Spring IoC
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
The Evolution of Java
The Evolution of JavaThe Evolution of Java
The Evolution of Java
 
Content provider in_android
Content provider in_androidContent provider in_android
Content provider in_android
 

En vedette

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
 
Android webservices
Android webservicesAndroid webservices
Android webservicesKrazy Koder
 
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
 

En vedette (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
 
Android webservices
Android webservicesAndroid webservices
Android webservices
 
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
 

Similaire à [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
 
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.pdfsuryamahathi1
 
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.pdfLaura Miller
 
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
 

Similaire à [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
 

Plus 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
 

Plus 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
 

Dernier

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 

Dernier (20)

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

[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