WEB SERVICES
THEORY & IMPLEMENTATION
Abdul Munim Dibosh (abdulmunim.buet@gmail.com)
CSE, BUET
What’s Web Service
• Application components
• Communicate using open protocols
• Self contained and self describing
• Can be consumed by any application
How does it work
• Internet protocol used : HTTP
• Platform Elements:
SOAP(Simple Object Access Protocol)
UDDI(Universal Description, Discovery & Integration)
WSDL(Web Services Description Language)
Why Web Service
• Interoperability – Web services enable exchanging data
between different applications and platforms.
• Can publish function or message to rest of the world
• Reusable application components
Popular Web Services
SOAP
• Simple Object Access Protocol
• Communication protocol
• Format for sending messages
• Platform independent
• Based on XML
• Allows to get around firewalls
WSDL
• Web Services Description Language
• Based on XML
• Used to describe web services
• Used to locate web services
I have something new…
Introducing REST
• REST stands for Representational State Transfer
• Large impact ; almost displaced SOAP and WSDL
RESTful Web Services
• Unique URL is representation of some object
• Uses HTTP for CRUD(Create/Read/Update/Delete)
operations
REST vs SOAP
• Rest
• Light-Weight
• Human readable
• Easy to build
• Access named resources through a single consistent interface
• Permits different data formats
• Example: getUser(Id)
• Soap
• Easy to consume-sometimes
• Rigid-adheres to a contract (Standard Specification)
• Exposes operations
• Permits XML
• Example: performTask(Id,task)
The main idea
• REST – Exposes a resource(object) via GET,POST etc.
What you will do with that object is up to you.
• SOAP - Exposes named operations to perform business
logic.
Example-SOAP
• Query the details of a given User-
<?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-en coding">
<soap:body pb="http://www.acme.com/phonebook"> <pb:GetUserDetails>
<pb:UserID>12345</pb:UserID> </pb:GetUserDetails>
</soap:Body> </soap:Envelope>
Example-REST
• Query the details of a given User-
http://www.acme.com/phonebook/UserDetails/12345
Enough talk, let's fight
code…

REST -Web services

  • 1.
    WEB SERVICES THEORY &IMPLEMENTATION Abdul Munim Dibosh (abdulmunim.buet@gmail.com) CSE, BUET
  • 2.
    What’s Web Service •Application components • Communicate using open protocols • Self contained and self describing • Can be consumed by any application
  • 3.
    How does itwork • Internet protocol used : HTTP • Platform Elements: SOAP(Simple Object Access Protocol) UDDI(Universal Description, Discovery & Integration) WSDL(Web Services Description Language)
  • 4.
    Why Web Service •Interoperability – Web services enable exchanging data between different applications and platforms. • Can publish function or message to rest of the world • Reusable application components
  • 5.
  • 6.
    SOAP • Simple ObjectAccess Protocol • Communication protocol • Format for sending messages • Platform independent • Based on XML • Allows to get around firewalls
  • 7.
    WSDL • Web ServicesDescription Language • Based on XML • Used to describe web services • Used to locate web services
  • 8.
  • 9.
    Introducing REST • RESTstands for Representational State Transfer • Large impact ; almost displaced SOAP and WSDL
  • 10.
    RESTful Web Services •Unique URL is representation of some object • Uses HTTP for CRUD(Create/Read/Update/Delete) operations
  • 11.
    REST vs SOAP •Rest • Light-Weight • Human readable • Easy to build • Access named resources through a single consistent interface • Permits different data formats • Example: getUser(Id) • Soap • Easy to consume-sometimes • Rigid-adheres to a contract (Standard Specification) • Exposes operations • Permits XML • Example: performTask(Id,task)
  • 12.
    The main idea •REST – Exposes a resource(object) via GET,POST etc. What you will do with that object is up to you. • SOAP - Exposes named operations to perform business logic.
  • 13.
    Example-SOAP • Query thedetails of a given User- <?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-en coding"> <soap:body pb="http://www.acme.com/phonebook"> <pb:GetUserDetails> <pb:UserID>12345</pb:UserID> </pb:GetUserDetails> </soap:Body> </soap:Envelope>
  • 14.
    Example-REST • Query thedetails of a given User- http://www.acme.com/phonebook/UserDetails/12345
  • 15.
    Enough talk, let'sfight code…