SlideShare a Scribd company logo
Web Service for Mobile
 5 jan 2013 @ Sripatum University

        Anuchit Chalothorn
       anoochit@gmail.com
About
●   Not a Teacher or Instructor
●   Not a Programmer or Developer
●   Senior Software Engineer at SIPA
●   Content writer not speaker
●   I use Linux :)
Rules
● You can leave every time.
● If you don't understand and you don't want to
  ask you can leave.
● If you want to learn by yourself and I'll give
  you a resources, you can leave.
● If you don't understand at all and everything
  as I said, you can leave and I'll give a
  resources, you can learning by yourself.
Quote
“If you cannot do great things, do small things
in a great way” - Napoleon Hill
You should know
●   Android
●   Java
●   PHP or some PHP Framework
●   Database System
●   Service Oriented Architecture (SOA)
●   HTTP Services
●   XML, JSON, Data Parsing
Web Service
A Web service is a method of communication
between two electronic devices over the World
Wide Web. A Web service is a software
function provided at a network address over the
web or the cloud, it is a service that is "always
on" as in the concept of utility computing.
Web Service
Two major classes of Web services
● REST-compliant Web services
● other
Web Services in old fashion
It has an interface described in a machine-
processable format (specifically Web Services
Description Language, known by the acronym
WSDL)
Interact
Systems interact with the Web service in a
manner prescribed by its description using
SOAP messages, typically conveyed using
HTTP with an XML serialization in conjunction
with other Web-related standards.
Simple diagram


                                          Yellow Pages                             WSDL
            WSDL




                              WSDL

        Requester                                                                Provider

                                              SOAP




Requester ask or search yellow pages which address and how to talk with provider. The yellow pages
    'll send the response by using WSDL how to talk which provide by Provider to the requester.
            Requester receives the address and methods then communicate with Provider.
Quote
"HTTP + XML = SOAP" - W3CSchool
SOAP Sample
If you want to request to SOAP server, you
must know
● URL
  ○ http://example.com/service.php
● WSDL
  ○ http://example.com/service.php?wsdl
● Soap Action
  ○ http://example.com/service.php/HelloWorld
● Method
  ○ HelloWorld
● Your data to sent
SOAP Request
POST /InStock HTTP/1.1
Host: www.example.org
Content-Type: application/soap+xml; charset=utf-8
Content-Length: nnn

<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Body xmlns:m="http://www.example.org/stock">
  <m:GetStockPrice>
    <m:StockName>IBM</m:StockName>
  </m:GetStockPrice>
</soap:Body>

</soap:Envelope>
SOAP Response
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: nnn

<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Body xmlns:m="http://www.example.org/stock">
  <m:GetStockPriceResponse>
    <m:Price>34.5</m:Price>
  </m:GetStockPriceResponse>
</soap:Body>

</soap:Envelope>
Web services in new fashion
Web API is a development in Web services
where emphasis has been moving away from
SOAP based services towards
representational state transfer (REST) based
communications.
RESTFul / REST API
a style of software architecture for distributed
systems such as the WWW. The REST
language uses nouns and verbs, and has an
emphasis on readability. Unlike SOAP, REST
does not require XML parsing and does not
require a message header to and from a
service provider.
Concept
● the base URI for the web service, such as
  http://example.com/resources/
● the Internet media type of the data
  supported by the web service.
● the set of operations supported by the web
  service using HTTP methods (e.g., GET,
  PUT, POST, or DELETE).
● The API must be hypertext driven.
Example URI
● http://example.org/user/
● http://example.org/user/anuchit
● http://search.twitter.com/search.json?q=xxx
Example methods
Resource                              GET              PUT             POST       DELETE

http://example.org/user        list collection   replace           create       delete

http://example.org/user/rose   list data         replace/ create   ? / create   delete
No "official" standard
There is no "official" standard for RESTful web
services, This is because REST is an
architectural style, unlike SOAP, which is a
protocol. Even though REST is not a standard,
a RESTful implementation such as the Web
can use standards like HTTP, URI, XML, etc.
Simple Diagram


              GET /user/anuchit HTTP/1.1


  Requester                                Provider



                  200 with some data
Data Format
XML

<?xml version="1.0"?>
<item>
    <name>Anuchit Chalothorn</name>
    <email>anoochit@gmail.com</email>
</item>
<item>
    <name>Sira Nokyongthong</name>
    <email>gumaraa@gmail.com</email>
</item>
Data Format
JSON
{
    "item": [
        {
            "name": "Anuchit Chalothorn",
            "email": "anoochit@gmail.com"
        },
        {
            "name": "Sira Nokyongthong",
            "email": "gumaraa@gmail.com"
        }
    ]
}
Shortcut - Web Services design
●   Choose method old style, new style
●   Look around an eco-system
●   Who'll using your services
●   How to implementation
●   Design and document
Mobile App & Web Services


                                                        http request
                               Data       Req



                                                                           Provider


   (2)       (1)
  Data      Parse           Res        Data
                                                         response




     * This is your destiny you cannot change your future, accept using vendor sdk's
Case Study - Plus Clever
● Game (Client)
  ○ sum a set of numbers in to 1 digit
  ○ score by level calculate from time remain and levels
  ○ each level has 10 sub-levels
  ○ never ending game BUT maximum is 10 digits to
    calculate
  ○ keep your high-score online (web service is here)
● Web Service (Server)
  ○ PaaS on OpenShift
  ○ PHP, CakePHP, MySQL
Case Study - Plus Clever




                     Enter Your Name

                            Dakota



    Ask a player name in the first time and keep value in SQLite
Case Study - Plus Clever



                          Your Score
                          1,000,000




 If player reach high score keep score in SQLite and publish score to server
Case Study - Plus Clever


                   World
               Leaderboard
              Xavier - 10,000,000
               Dakota - 1,000,000
                 Luxor - 50,000
                  Keva - 6,000




         Ask score server for world leader board.
Case Study - Plus Clever
●   REST API
●   Using JSON as data
●   Using CakePHP to implement score service
●   Put in the Cloud ~ OpenShift by RedHat
In Real Life
● Plus Clever in Google Play
    ○ http://tinyurl.com/plusclever
●   Score server
    ○ https://rest-redlinemobi.rhcloud.com/score/
Code in GitHub
● Score Server
    ○ https://github.com/anoochit/rest-score
●   Score Server Test
    ○ https://github.com/anoochit/rest-score-test
●   Plus Clever Game
    ○ https://github.com/anoochit/plusclaver-game
Your Case Study - WattPad ?
I'm too old, anyone can describe this
● What is WattPad ?
● What is WattPad do ?
● Who are using WattPad ?
● How to use WattPad ?
   ...
   ...
   ...
Quote
“If you cannot do great things, do small things
in a great way” - Napoleon Hill
Small things for you
Make Web Services of this small things
● HelloWorld
● Echo your name
● Asking for Date Time
● Temperature Unit Converter
● Search Telephone Number
Small things for you
Make Mobile App by calling your web service
● HelloWorld
● Echo your name
● Asking for Date Time
● Temperature Unit Converter
● Search Telephone Number
PHP (native)
You can use json_encode() function to
generate JSON string from mix value like
associative array

$data = array("result"=>"hello","success"=>true);
echo json_encode($data);
Browser use GET method
if you want to test your RESTful web service by
sent another method, try this
● Advanced REST Client for Chrome
● REST Client for Firefox
Call Web Service

                               GET /user/anoochit

                                                                      REST
     Android
                                                                      Server

                           200 OK with XML or JSON string




●   HTTP request                                            ●   Check request method
●   Method GET, POST, PUT or DELETE                         ●   Parse data from URI
●   Get BufferReader and pack into                          ●   Process
    "String" <= JSON String                                 ●   Return XML or JSON string
●   Parse "String Key"
●   Get your value
Small resources
● Thai Create Good Mobile Tutorial
  ○ http://www.thaicreate.com/mobile.html
2 Hours
finish & present
Your Code
Check out an example for REST Server and
Mobile Client at
● https://github.com/anoochit/spurest
Thank You

More Related Content

What's hot

Web performance optimization - MercadoLibre
Web performance optimization - MercadoLibreWeb performance optimization - MercadoLibre
Web performance optimization - MercadoLibre
Pablo Moretti
 
Php workshop L02 php basics
Php workshop L02 php basicsPhp workshop L02 php basics
Php workshop L02 php basics
Mohammad Tahsin Alshalabi
 
University of Delaware - Improving Web Protocols (early SPDY talk)
University of Delaware - Improving Web Protocols (early SPDY talk)University of Delaware - Improving Web Protocols (early SPDY talk)
University of Delaware - Improving Web Protocols (early SPDY talk)
Mike Belshe
 
Mongodb
MongodbMongodb
Mongodb
Scott Motte
 
Node js crash course session 5
Node js crash course   session 5Node js crash course   session 5
Node js crash course session 5
Abdul Rahman Masri Attal
 
Introduction of javascript
Introduction of javascriptIntroduction of javascript
Introduction of javascript
syeda zoya mehdi
 
Introduction about-ajax-framework
Introduction about-ajax-frameworkIntroduction about-ajax-framework
Introduction about-ajax-framework
Sakthi Bro
 
Node js crash course session 6
Node js crash course   session 6Node js crash course   session 6
Node js crash course session 6
Abdul Rahman Masri Attal
 
Introduction to javaScript
Introduction to javaScriptIntroduction to javaScript
Introduction to javaScriptNeil Ghosh
 
Javascript cross domain communication
Javascript cross domain communicationJavascript cross domain communication
Javascript cross domain communication
ChenKuo Chen
 
At Your Service - Abusing the Service Workers Web API
At Your Service - Abusing the Service Workers Web APIAt Your Service - Abusing the Service Workers Web API
At Your Service - Abusing the Service Workers Web API
Daniel Abeles
 

What's hot (12)

Web performance optimization - MercadoLibre
Web performance optimization - MercadoLibreWeb performance optimization - MercadoLibre
Web performance optimization - MercadoLibre
 
Php workshop L02 php basics
Php workshop L02 php basicsPhp workshop L02 php basics
Php workshop L02 php basics
 
University of Delaware - Improving Web Protocols (early SPDY talk)
University of Delaware - Improving Web Protocols (early SPDY talk)University of Delaware - Improving Web Protocols (early SPDY talk)
University of Delaware - Improving Web Protocols (early SPDY talk)
 
Mongodb
MongodbMongodb
Mongodb
 
Node js crash course session 5
Node js crash course   session 5Node js crash course   session 5
Node js crash course session 5
 
Introduction of javascript
Introduction of javascriptIntroduction of javascript
Introduction of javascript
 
Introduction about-ajax-framework
Introduction about-ajax-frameworkIntroduction about-ajax-framework
Introduction about-ajax-framework
 
Node js crash course session 6
Node js crash course   session 6Node js crash course   session 6
Node js crash course session 6
 
Introduction to javaScript
Introduction to javaScriptIntroduction to javaScript
Introduction to javaScript
 
Javascript cross domain communication
Javascript cross domain communicationJavascript cross domain communication
Javascript cross domain communication
 
At Your Service - Abusing the Service Workers Web API
At Your Service - Abusing the Service Workers Web APIAt Your Service - Abusing the Service Workers Web API
At Your Service - Abusing the Service Workers Web API
 
Practical MySQL
Practical MySQLPractical MySQL
Practical MySQL
 

Viewers also liked

Develop ASP.Net Web Service
Develop ASP.Net Web Service Develop ASP.Net Web Service
Develop ASP.Net Web Service
Safaa Farouk
 
Web Service Implementation Using ASP.NET
Web Service Implementation Using ASP.NETWeb Service Implementation Using ASP.NET
Web Service Implementation Using ASP.NETPonraj
 
Web mashup
Web mashupWeb mashup
Web mashup
Ambarish Hazarnis
 
Json-based Service Oriented Architecture for the web
Json-based Service Oriented Architecture for the webJson-based Service Oriented Architecture for the web
Json-based Service Oriented Architecture for the webkriszyp
 
Web Service Presentation
Web Service PresentationWeb Service Presentation
Web Service Presentation
guest0df6b0
 
Best Practices in Web Service Design
Best Practices in Web Service DesignBest Practices in Web Service Design
Best Practices in Web Service DesignLorna Mitchell
 
Introduction to Web Service
Introduction to Web Service Introduction to Web Service
Introduction to Web Service
Tanya Sattaya-aphitan
 

Viewers also liked (10)

Web service
Web serviceWeb service
Web service
 
Develop ASP.Net Web Service
Develop ASP.Net Web Service Develop ASP.Net Web Service
Develop ASP.Net Web Service
 
Web Service Implementation Using ASP.NET
Web Service Implementation Using ASP.NETWeb Service Implementation Using ASP.NET
Web Service Implementation Using ASP.NET
 
Web mashup
Web mashupWeb mashup
Web mashup
 
Web service introduction 2
Web service introduction 2Web service introduction 2
Web service introduction 2
 
Json-based Service Oriented Architecture for the web
Json-based Service Oriented Architecture for the webJson-based Service Oriented Architecture for the web
Json-based Service Oriented Architecture for the web
 
Web service introduction
Web service introductionWeb service introduction
Web service introduction
 
Web Service Presentation
Web Service PresentationWeb Service Presentation
Web Service Presentation
 
Best Practices in Web Service Design
Best Practices in Web Service DesignBest Practices in Web Service Design
Best Practices in Web Service Design
 
Introduction to Web Service
Introduction to Web Service Introduction to Web Service
Introduction to Web Service
 

Similar to Web Service and Mobile Integrated Day I

Android App Development 06 : Network &amp; Web Services
Android App Development 06 : Network &amp; Web ServicesAndroid App Development 06 : Network &amp; Web Services
Android App Development 06 : Network &amp; Web ServicesAnuchit Chalothorn
 
API
APIAPI
Switch to Backend 2023
Switch to Backend 2023Switch to Backend 2023
Design Web Service API by HungerStation
Design Web Service API by HungerStationDesign Web Service API by HungerStation
Design Web Service API by HungerStation
ArabNet ME
 
Consuming RESTful Web services in PHP
Consuming RESTful Web services in PHPConsuming RESTful Web services in PHP
Consuming RESTful Web services in PHP
Zoran Jeremic
 
Consuming RESTful services in PHP
Consuming RESTful services in PHPConsuming RESTful services in PHP
Consuming RESTful services in PHPZoran Jeremic
 
GraphQL is actually rest
GraphQL is actually restGraphQL is actually rest
GraphQL is actually rest
Jakub Riedl
 
Ten practical ways to improve front-end performance
Ten practical ways to improve front-end performanceTen practical ways to improve front-end performance
Ten practical ways to improve front-end performance
Andrew Rota
 
202107 - Orion introduction - COSCUP
202107 - Orion introduction - COSCUP202107 - Orion introduction - COSCUP
202107 - Orion introduction - COSCUP
Ronald Hsu
 
Communication Protocols And Web Services
Communication Protocols And Web ServicesCommunication Protocols And Web Services
Communication Protocols And Web ServicesOmer Katz
 
WEB TECHNOLOGY Unit-5.pptx
WEB TECHNOLOGY Unit-5.pptxWEB TECHNOLOGY Unit-5.pptx
WEB TECHNOLOGY Unit-5.pptx
karthiksmart21
 
Wp JSON API and You!
Wp JSON API and You!Wp JSON API and You!
Wp JSON API and You!
Jamal_972
 
Web Services PHP Tutorial
Web Services PHP TutorialWeb Services PHP Tutorial
Web Services PHP Tutorial
Lorna Mitchell
 
Web Services Tutorial
Web Services TutorialWeb Services Tutorial
Web Services Tutorial
Lorna Mitchell
 
PHP BASIC PRESENTATION
PHP BASIC PRESENTATIONPHP BASIC PRESENTATION
PHP BASIC PRESENTATION
krutitrivedi
 
RESTful web
RESTful webRESTful web
RESTful web
Alvin Qi
 
Cqrs api
Cqrs apiCqrs api
Cqrs api
Brandon Mueller
 
Puppet – Make stateful apps easier than stateless
Puppet – Make stateful apps easier than statelessPuppet – Make stateful apps easier than stateless
Puppet – Make stateful apps easier than stateless
Starcounter
 

Similar to Web Service and Mobile Integrated Day I (20)

Android App Development 06 : Network &amp; Web Services
Android App Development 06 : Network &amp; Web ServicesAndroid App Development 06 : Network &amp; Web Services
Android App Development 06 : Network &amp; Web Services
 
API
APIAPI
API
 
Switch to Backend 2023
Switch to Backend 2023Switch to Backend 2023
Switch to Backend 2023
 
Design Web Service API by HungerStation
Design Web Service API by HungerStationDesign Web Service API by HungerStation
Design Web Service API by HungerStation
 
Consuming RESTful Web services in PHP
Consuming RESTful Web services in PHPConsuming RESTful Web services in PHP
Consuming RESTful Web services in PHP
 
Consuming RESTful services in PHP
Consuming RESTful services in PHPConsuming RESTful services in PHP
Consuming RESTful services in PHP
 
GraphQL is actually rest
GraphQL is actually restGraphQL is actually rest
GraphQL is actually rest
 
Ten practical ways to improve front-end performance
Ten practical ways to improve front-end performanceTen practical ways to improve front-end performance
Ten practical ways to improve front-end performance
 
Cqrs api v2
Cqrs api v2Cqrs api v2
Cqrs api v2
 
202107 - Orion introduction - COSCUP
202107 - Orion introduction - COSCUP202107 - Orion introduction - COSCUP
202107 - Orion introduction - COSCUP
 
Communication Protocols And Web Services
Communication Protocols And Web ServicesCommunication Protocols And Web Services
Communication Protocols And Web Services
 
WEB TECHNOLOGY Unit-5.pptx
WEB TECHNOLOGY Unit-5.pptxWEB TECHNOLOGY Unit-5.pptx
WEB TECHNOLOGY Unit-5.pptx
 
Wp JSON API and You!
Wp JSON API and You!Wp JSON API and You!
Wp JSON API and You!
 
Web Services PHP Tutorial
Web Services PHP TutorialWeb Services PHP Tutorial
Web Services PHP Tutorial
 
Web Services Tutorial
Web Services TutorialWeb Services Tutorial
Web Services Tutorial
 
PHP BASIC PRESENTATION
PHP BASIC PRESENTATIONPHP BASIC PRESENTATION
PHP BASIC PRESENTATION
 
RESTful web
RESTful webRESTful web
RESTful web
 
Cqrs api
Cqrs apiCqrs api
Cqrs api
 
Puppet – Make stateful apps easier than stateless
Puppet – Make stateful apps easier than statelessPuppet – Make stateful apps easier than stateless
Puppet – Make stateful apps easier than stateless
 
Ajax
AjaxAjax
Ajax
 

More from Anuchit Chalothorn

Flutter Workshop 2021 @ ARU
Flutter Workshop 2021 @ ARUFlutter Workshop 2021 @ ARU
Flutter Workshop 2021 @ ARU
Anuchit Chalothorn
 
Flutter workshop @ bang saen 2020
Flutter workshop @ bang saen 2020Flutter workshop @ bang saen 2020
Flutter workshop @ bang saen 2020
Anuchit Chalothorn
 
13 web service integration
13 web service integration13 web service integration
13 web service integration
Anuchit Chalothorn
 
09 material design
09 material design09 material design
09 material design
Anuchit Chalothorn
 
07 intent
07 intent07 intent
05 binding and action
05 binding and action05 binding and action
05 binding and action
Anuchit Chalothorn
 
04 layout design and basic widget
04 layout design and basic widget04 layout design and basic widget
04 layout design and basic widget
Anuchit Chalothorn
 
03 activity life cycle
03 activity life cycle03 activity life cycle
03 activity life cycle
Anuchit Chalothorn
 
02 create your first app
02 create your first app02 create your first app
02 create your first app
Anuchit Chalothorn
 
01 introduction
01 introduction 01 introduction
01 introduction
Anuchit Chalothorn
 
Material Theme
Material ThemeMaterial Theme
Material Theme
Anuchit Chalothorn
 
00 Android Wear Setup Emulator
00 Android Wear Setup Emulator00 Android Wear Setup Emulator
00 Android Wear Setup Emulator
Anuchit Chalothorn
 
MongoDB Replication Cluster
MongoDB Replication ClusterMongoDB Replication Cluster
MongoDB Replication Cluster
Anuchit Chalothorn
 
MongoDB Shard Cluster
MongoDB Shard ClusterMongoDB Shard Cluster
MongoDB Shard Cluster
Anuchit Chalothorn
 
IT Automation with Chef
IT Automation with ChefIT Automation with Chef
IT Automation with Chef
Anuchit Chalothorn
 
IT Automation with Puppet Enterprise
IT Automation with Puppet EnterpriseIT Automation with Puppet Enterprise
IT Automation with Puppet Enterprise
Anuchit Chalothorn
 
Using PhoneGap Command Line
Using PhoneGap Command LineUsing PhoneGap Command Line
Using PhoneGap Command Line
Anuchit Chalothorn
 
Collaborative development with Git | Workshop
Collaborative development with Git | WorkshopCollaborative development with Git | Workshop
Collaborative development with Git | Workshop
Anuchit Chalothorn
 

More from Anuchit Chalothorn (20)

Flutter Workshop 2021 @ ARU
Flutter Workshop 2021 @ ARUFlutter Workshop 2021 @ ARU
Flutter Workshop 2021 @ ARU
 
Flutter workshop @ bang saen 2020
Flutter workshop @ bang saen 2020Flutter workshop @ bang saen 2020
Flutter workshop @ bang saen 2020
 
13 web service integration
13 web service integration13 web service integration
13 web service integration
 
09 material design
09 material design09 material design
09 material design
 
07 intent
07 intent07 intent
07 intent
 
05 binding and action
05 binding and action05 binding and action
05 binding and action
 
04 layout design and basic widget
04 layout design and basic widget04 layout design and basic widget
04 layout design and basic widget
 
03 activity life cycle
03 activity life cycle03 activity life cycle
03 activity life cycle
 
02 create your first app
02 create your first app02 create your first app
02 create your first app
 
01 introduction
01 introduction 01 introduction
01 introduction
 
Material Theme
Material ThemeMaterial Theme
Material Theme
 
00 Android Wear Setup Emulator
00 Android Wear Setup Emulator00 Android Wear Setup Emulator
00 Android Wear Setup Emulator
 
MongoDB Replication Cluster
MongoDB Replication ClusterMongoDB Replication Cluster
MongoDB Replication Cluster
 
MongoDB Shard Cluster
MongoDB Shard ClusterMongoDB Shard Cluster
MongoDB Shard Cluster
 
IT Automation with Chef
IT Automation with ChefIT Automation with Chef
IT Automation with Chef
 
IT Automation with Puppet Enterprise
IT Automation with Puppet EnterpriseIT Automation with Puppet Enterprise
IT Automation with Puppet Enterprise
 
Using PhoneGap Command Line
Using PhoneGap Command LineUsing PhoneGap Command Line
Using PhoneGap Command Line
 
Collaborative development with Git | Workshop
Collaborative development with Git | WorkshopCollaborative development with Git | Workshop
Collaborative development with Git | Workshop
 
OpenStack Cheat Sheet V2
OpenStack Cheat Sheet V2OpenStack Cheat Sheet V2
OpenStack Cheat Sheet V2
 
REST API with CakePHP
REST API with CakePHPREST API with CakePHP
REST API with CakePHP
 

Recently uploaded

Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 

Recently uploaded (20)

Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 

Web Service and Mobile Integrated Day I

  • 1. Web Service for Mobile 5 jan 2013 @ Sripatum University Anuchit Chalothorn anoochit@gmail.com
  • 2. About ● Not a Teacher or Instructor ● Not a Programmer or Developer ● Senior Software Engineer at SIPA ● Content writer not speaker ● I use Linux :)
  • 3. Rules ● You can leave every time. ● If you don't understand and you don't want to ask you can leave. ● If you want to learn by yourself and I'll give you a resources, you can leave. ● If you don't understand at all and everything as I said, you can leave and I'll give a resources, you can learning by yourself.
  • 4. Quote “If you cannot do great things, do small things in a great way” - Napoleon Hill
  • 5. You should know ● Android ● Java ● PHP or some PHP Framework ● Database System ● Service Oriented Architecture (SOA) ● HTTP Services ● XML, JSON, Data Parsing
  • 6. Web Service A Web service is a method of communication between two electronic devices over the World Wide Web. A Web service is a software function provided at a network address over the web or the cloud, it is a service that is "always on" as in the concept of utility computing.
  • 7. Web Service Two major classes of Web services ● REST-compliant Web services ● other
  • 8. Web Services in old fashion It has an interface described in a machine- processable format (specifically Web Services Description Language, known by the acronym WSDL)
  • 9. Interact Systems interact with the Web service in a manner prescribed by its description using SOAP messages, typically conveyed using HTTP with an XML serialization in conjunction with other Web-related standards.
  • 10.
  • 11. Simple diagram Yellow Pages WSDL WSDL WSDL Requester Provider SOAP Requester ask or search yellow pages which address and how to talk with provider. The yellow pages 'll send the response by using WSDL how to talk which provide by Provider to the requester. Requester receives the address and methods then communicate with Provider.
  • 12. Quote "HTTP + XML = SOAP" - W3CSchool
  • 13. SOAP Sample If you want to request to SOAP server, you must know ● URL ○ http://example.com/service.php ● WSDL ○ http://example.com/service.php?wsdl ● Soap Action ○ http://example.com/service.php/HelloWorld ● Method ○ HelloWorld ● Your data to sent
  • 14. SOAP Request POST /InStock HTTP/1.1 Host: www.example.org Content-Type: application/soap+xml; charset=utf-8 Content-Length: nnn <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> <soap:Body xmlns:m="http://www.example.org/stock"> <m:GetStockPrice> <m:StockName>IBM</m:StockName> </m:GetStockPrice> </soap:Body> </soap:Envelope>
  • 15. SOAP Response HTTP/1.1 200 OK Content-Type: application/soap+xml; charset=utf-8 Content-Length: nnn <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> <soap:Body xmlns:m="http://www.example.org/stock"> <m:GetStockPriceResponse> <m:Price>34.5</m:Price> </m:GetStockPriceResponse> </soap:Body> </soap:Envelope>
  • 16. Web services in new fashion Web API is a development in Web services where emphasis has been moving away from SOAP based services towards representational state transfer (REST) based communications.
  • 17. RESTFul / REST API a style of software architecture for distributed systems such as the WWW. The REST language uses nouns and verbs, and has an emphasis on readability. Unlike SOAP, REST does not require XML parsing and does not require a message header to and from a service provider.
  • 18. Concept ● the base URI for the web service, such as http://example.com/resources/ ● the Internet media type of the data supported by the web service. ● the set of operations supported by the web service using HTTP methods (e.g., GET, PUT, POST, or DELETE). ● The API must be hypertext driven.
  • 19. Example URI ● http://example.org/user/ ● http://example.org/user/anuchit ● http://search.twitter.com/search.json?q=xxx
  • 20. Example methods Resource GET PUT POST DELETE http://example.org/user list collection replace create delete http://example.org/user/rose list data replace/ create ? / create delete
  • 21. No "official" standard There is no "official" standard for RESTful web services, This is because REST is an architectural style, unlike SOAP, which is a protocol. Even though REST is not a standard, a RESTful implementation such as the Web can use standards like HTTP, URI, XML, etc.
  • 22. Simple Diagram GET /user/anuchit HTTP/1.1 Requester Provider 200 with some data
  • 23. Data Format XML <?xml version="1.0"?> <item> <name>Anuchit Chalothorn</name> <email>anoochit@gmail.com</email> </item> <item> <name>Sira Nokyongthong</name> <email>gumaraa@gmail.com</email> </item>
  • 24. Data Format JSON { "item": [ { "name": "Anuchit Chalothorn", "email": "anoochit@gmail.com" }, { "name": "Sira Nokyongthong", "email": "gumaraa@gmail.com" } ] }
  • 25. Shortcut - Web Services design ● Choose method old style, new style ● Look around an eco-system ● Who'll using your services ● How to implementation ● Design and document
  • 26. Mobile App & Web Services http request Data Req Provider (2) (1) Data Parse Res Data response * This is your destiny you cannot change your future, accept using vendor sdk's
  • 27. Case Study - Plus Clever ● Game (Client) ○ sum a set of numbers in to 1 digit ○ score by level calculate from time remain and levels ○ each level has 10 sub-levels ○ never ending game BUT maximum is 10 digits to calculate ○ keep your high-score online (web service is here) ● Web Service (Server) ○ PaaS on OpenShift ○ PHP, CakePHP, MySQL
  • 28. Case Study - Plus Clever Enter Your Name Dakota Ask a player name in the first time and keep value in SQLite
  • 29. Case Study - Plus Clever Your Score 1,000,000 If player reach high score keep score in SQLite and publish score to server
  • 30. Case Study - Plus Clever World Leaderboard Xavier - 10,000,000 Dakota - 1,000,000 Luxor - 50,000 Keva - 6,000 Ask score server for world leader board.
  • 31. Case Study - Plus Clever ● REST API ● Using JSON as data ● Using CakePHP to implement score service ● Put in the Cloud ~ OpenShift by RedHat
  • 32. In Real Life ● Plus Clever in Google Play ○ http://tinyurl.com/plusclever ● Score server ○ https://rest-redlinemobi.rhcloud.com/score/
  • 33. Code in GitHub ● Score Server ○ https://github.com/anoochit/rest-score ● Score Server Test ○ https://github.com/anoochit/rest-score-test ● Plus Clever Game ○ https://github.com/anoochit/plusclaver-game
  • 34. Your Case Study - WattPad ? I'm too old, anyone can describe this ● What is WattPad ? ● What is WattPad do ? ● Who are using WattPad ? ● How to use WattPad ? ... ... ...
  • 35. Quote “If you cannot do great things, do small things in a great way” - Napoleon Hill
  • 36. Small things for you Make Web Services of this small things ● HelloWorld ● Echo your name ● Asking for Date Time ● Temperature Unit Converter ● Search Telephone Number
  • 37. Small things for you Make Mobile App by calling your web service ● HelloWorld ● Echo your name ● Asking for Date Time ● Temperature Unit Converter ● Search Telephone Number
  • 38. PHP (native) You can use json_encode() function to generate JSON string from mix value like associative array $data = array("result"=>"hello","success"=>true); echo json_encode($data);
  • 39. Browser use GET method if you want to test your RESTful web service by sent another method, try this ● Advanced REST Client for Chrome ● REST Client for Firefox
  • 40. Call Web Service GET /user/anoochit REST Android Server 200 OK with XML or JSON string ● HTTP request ● Check request method ● Method GET, POST, PUT or DELETE ● Parse data from URI ● Get BufferReader and pack into ● Process "String" <= JSON String ● Return XML or JSON string ● Parse "String Key" ● Get your value
  • 41. Small resources ● Thai Create Good Mobile Tutorial ○ http://www.thaicreate.com/mobile.html
  • 42. 2 Hours finish & present
  • 43. Your Code Check out an example for REST Server and Mobile Client at ● https://github.com/anoochit/spurest