SlideShare a Scribd company logo
1 of 44
Download to read offline
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 - MercadoLibrePablo Moretti
 
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
 
Introduction of javascript
Introduction of javascriptIntroduction of javascript
Introduction of javascriptsyeda zoya mehdi
 
Introduction about-ajax-framework
Introduction about-ajax-frameworkIntroduction about-ajax-framework
Introduction about-ajax-frameworkSakthi Bro
 
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 communicationChenKuo 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 APIDaniel 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
 
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 Presentationguest0df6b0
 
Best Practices in Web Service Design
Best Practices in Web Service DesignBest Practices in Web Service Design
Best Practices in Web Service DesignLorna Mitchell
 

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
 
Design Web Service API by HungerStation
Design Web Service API by HungerStationDesign Web Service API by HungerStation
Design Web Service API by HungerStationArabNet ME
 
Consuming RESTful Web services in PHP
Consuming RESTful Web services in PHPConsuming RESTful Web services in PHP
Consuming RESTful Web services in PHPZoran 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 restJakub 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 performanceAndrew Rota
 
202107 - Orion introduction - COSCUP
202107 - Orion introduction - COSCUP202107 - Orion introduction - COSCUP
202107 - Orion introduction - COSCUPRonald 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.pptxkarthiksmart21
 
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 TutorialLorna Mitchell
 
PHP BASIC PRESENTATION
PHP BASIC PRESENTATIONPHP BASIC PRESENTATION
PHP BASIC PRESENTATIONkrutitrivedi
 
RESTful web
RESTful webRESTful web
RESTful webAlvin Qi
 
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 statelessStarcounter
 

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 (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

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 

Recently uploaded (20)

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 

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