Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Web Services – Part I CS 236607, Spring 2008/9.

Similar presentations


Presentation on theme: "1 Web Services – Part I CS 236607, Spring 2008/9."— Presentation transcript:

1 1 Web Services – Part I CS , Spring 2008/9

2 2 What is a Web Service? Web Service: 1. "Web services are loosely coupled software components delivered over Internet standard technologies." 2. “Software that makes services available on a network using technologies such as XML and HTTP” Service-Oriented Architecture (SOA):  “Development of applications from distributed collections of smaller loosely coupled service providers” Web services support service-oriented architectures, using in particular XML and HTTP.

3 3 What is a Web Service? (Cont.) Self-contained, modular Web application that can be published, located and invoked across the Web A Web service can perform functions of varying complexities. Once deployed, other applications (and other Web services) can discover and invoke the deployed service

4 4 Why a New Framework? CORBA, DCOM, Java/RMI,... already exist XML+HTTP: platform neutral, widely accepted and utilized

5 Example Scenario – Online Trade Book Store The Hobbit (5) Price: Copies in Stock: 1 The Hobbit (5) Price: Copies in Stock: 0 Book Store The Hobbit (5) Price: Copies in Stock: 5 Buy The Hobbit (5) How Much? Buy it The Hobbit (5) Price: Copies in Stock: 4 The Hobbit (5) Price: Copies in Stock: 1 The Hobbit (5) Price: Copies in Stock: 0

6 6 Why is it Difficult to Use Ordinary Web Sites as Services? Consider an application that should return the price of the book “The Hobbit”  The application needs to fill the required form and launch a “browser-like” request  The application needs to parse the page, based on its specific HTML structure, and retrieve the price  Once the Web site changes its user interface, your program is useless  How can we find new online stores?

7 What is the price here? How can we find this URL?

8 8 Calling Remote Functions Could Help It would help if we could call functions, such as:  Amazon.getPrice(“The Hobbit")  Amazon.buyBook(“The Hobbit", myId) getPrice(…) The Internet

9 9 Difficulties in Using Remote Functions For each remote function, we need to phrase a call in the specific language that is used for its implementation For each remote function, we need to contact the provider in order to find out what exactly the signature (i.e., parameters, return value, inc. the type) is On the server side, each remote function needs to listen to a server socket bound to a specific port  Not in line with protection by firewalls

10 10 A Solution Use an agreed interface and a syntax that all applications are familiar with (e.g., XML)  For example, SOAP Use HTTP to transfer data through port 80 Use a standard for publishing methods, their signatures and their usage  For example, WSDL Use standard directory structures for publishing available services  For example, UDDI

11 11 Available Web Services Examples Google search (http://www.google.com/apis) Weather reports Stock prices Currency exchanges Sending SMS messages, faxes Prices of books in Barnes and Nobles Dictionaries And more…

12 12 Essential Technologies A range of protocols has been suggested in the last years. We will discuss what are commonly believed to be the essential technologies:  SOAP – exchanging XML messages on a network  WSDL – describing interfaces of Web services  UDDI – managing registries of Web services SERVICE REGISTRY SERVICE USER (Client) SERVICE PROVIDER publish messages find

13 13 SOAP Used to be “Simple Object Access Protocol” but no longer an acronym...

14 14 What is SOAP? SOAP is a protocol for invoking Web Services SOAP is XML based In SOAP, applications may exchange information over HTTP  HTTP is just one possible communication pattern supported by SOAP (e.g. SMTP)

15 15 SOAP Envelope... Envelope Headers:  Encryption information  Access control  Routing ...

16 < soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> Euro Israel A request to services.xmethods.net:80

17 < n:getRateResponse xmlns:n='urn:xmethods-CurrencyExchange'> The Response

18 18 A SOAP Message A SOAP message is an ordinary XML document containing the following elements:  Envelope – identifies the XML document as a SOAP message: required  Header – contains header information: optional  Body – contains call or response information: required  Fault – provides information about errors that occurred while processing the message: optional

19 19 Special SOAP Header Attributes mustUnderstand And more Example:... gzip+base64... INITIAL SENDER INTERMEDIARY ULTIMATE RECEIVER role

20 20 SOAP Response on Error In loosely connected distributed systems many things can go wrong:  Invalid data may be transmitted  Servers may be unavailable SOAP provides a uniform way to indicate such errors.

21 21 Faults Example env:Sender w:InvalidBuyRequest The value of 'amount' is invalid! Værdien af 'amount' er ugyldig!

22 22 Protocol Binding Transmitting a SOAP message requires a communication protocol to carry the message. This is called SOAP protocol binding. Transmission protocols: HTTP, SMTP,... Message exchange patterns:  request–response (for RPC)  POST  SOAP response (Only the response is a SOAP message)  GET How will we know what To use?

23 23 WSDL Web Services Description Language

24 24 Describing a Web Service Need a standard way to describe a Web Service:  The methods available  Their parameters  How to communicate  Etc.

25 25 Describing a Web Service – WSDL Answer WSDL is a standard for describing Web services using XML. WSDL Can Describe:  What a Web service can do  Where it resides  How to invoke it

26 Structure of a WSDL Description ...

Similar presentations


Ads by Google