Web Services: RPC, Soap and Rest
Web Services: RPC, Soap and Rest
Web Services: RPC, Soap and Rest
Blog : http://prady00.com
Twitter : http://twitter.com/prady00
These days : http://jsBunch.com
This presentation : http://www.slideshare.net/prady00/
Code Examples :
https://github.com/prady00/TG_Webservices
Agenda
Agenda
Services can be :
Infrastructure or Platform : Amazon S3
Reusable software component : Currency APIs
Data : Facebook, Twitter
and .
Web site
Web services
Easy to interoperate
It is Easy to use
It can be standardized
It allows using legacy
Language independence
SOAP
- Simple Object Access Protocol
REST
- REpresentational State Transfer
GE
P
T
HT
T
OS
P
r
To
o
p
s
e
Vr
S
C
i
e
s
n
DY
O
B
P
T
HT
XML RPC
Protocol which uses XML to encode
its calls and HTTP POST as a
transport mechanism.
XML RPC standards : Link
Standards specify
Data types : arrays, boolean, string etc
Structure of request and response
Transport specs
Corresponding function to
XML RPC Request execute
and generates response
est
u
q
Re
C
P
R
XML
on
p
s
e
CR
P
R
XML
se
SOAP
Modified version of XML RPC
More powerful than XML RPC
Based on WSDL (Web Services
Description Language) and UDDI
(Universal Description Discovery and
Integration)
SOAP Standards : Link
What standards : Data types,
Structure and namespaces/attributes
standards.
SOAP
SOAP : Structure
Coded somewhere :
float getStockPrice(String IBM){
// get stock price from some IS
return stockPrice;
}
Corresponding function to
SOAP Request executes
and generates response
est
u
q
Re
P
A
SO
nse
o
p
s
Re
P
A
SO
SOAP : Critiques
Versatile, can use different
protocols : SMTP
More powerful
Automated tools exists
Uses XML
Supports WSDL
Too verbose
REST
Its not a protocol, its an
architectural approach.
Can be used with legacy XML or
modern JSON information transfer
format
Guidelines : HTTP methods and
corresponding CRUD operation,
recommendation about URI design.
REST : Principles
Be stateless
Use HTTP methods for CRUD
operations
Directory like structure
Use proper MIME types
REST
SELECT
GET
INSERT
POST
UPDATE
PUT
DELETE
DELETE
HTTP METHOD
ACTION
PERFORMED
/status/
GET
/status/3
GET
/status/
POST
/status/4
PUT
/status/4
DELETE
Informational
200
OK
201
Resource created
204
No content
400
Bad Request
401
Unauthorised
404
Not found
405
500
HTTP METHOD
POST
ACTION
PERFORMED
Add a new status
P
HTT
st
e
u
Req
or
L
M
X
or *
N
JSO
n se
o
p
s
Re
P
T
HT
REST : Critiques
REST API
Client
Third party system
Legacy
Resources
Modern Moves
Questions