Slide 1

Slide 1 text

Web service and Its integration in Android - By Paresh Mayani (@pareshmayani) Internet Database Database Web Services

Slide 2

Slide 2 text

Web service? • The W3C defines a “web service” as “a software system designed to support interoperable machine-to-machine interaction over a network.

Slide 3

Slide 3 text

Request Sending data like Name, Address Method GET, POST Response Receiving data FORMAT XML / JSON

Slide 4

Slide 4 text

Categories of web service • SOAP Web Service • RESTful Web Service

Slide 5

Slide 5 text

Soap Web Service • Simple Object Access Protocol • An XML-based messaging protocol. • Communication between the web service and client happens using XML messages • SOAP defines the rules for communication like what are all the tags that should be used in XML and their meaning.

Slide 6

Slide 6 text

RESTful Web Service • Representational State Transfer (REST) • Describe an architecture style of networked systems. • An Architectural Style, Not a Standard • It uses architectures that use HTTP or similar protocols by restricting the interface to use standard operations like GET, POST, PUT, DELETE for HTTP

Slide 7

Slide 7 text

Goodbye SOAP – Welcome JSON REST • Lightweight - not a lot of extra xml markup • Human Readable Results

Slide 8

Slide 8 text

JSON • JavaScript Object Notation • It is a lightweight data-interchange format. • It is easy for humans to read and write. • It is easy for machines to parse and generate. JSON is built on two structures: • A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array. • An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence. • Reference: http://www.json.org/

Slide 9

Slide 9 text

JSON Structure JSON Object JSON Array http://www.technotalkative.com/android-json-parsing/

Slide 10

Slide 10 text

+ HTTP • Option 1: java.net.URL; java.net.HttpURLConnection; • Option 2: HTTPClient API

Slide 11

Slide 11 text

HttpClient API

Slide 12

Slide 12 text

Request

Slide 13

Slide 13 text

Request

Slide 14

Slide 14 text

No Request

Slide 15

Slide 15 text

Get in Touch twitter.com/pareshmayani fb.com/GDGAhmedabad http://gplus.to/GDGAhmedabad http://www.technotalkative.com/