- Количество слайдов: 26
What are Web Services? r Today, we normally use Web browsers to talk to Web sites m Browser names document via URL (lots of fun and games can happen here) m Request and reply encoded in HTML, using HTTP to issue request to the site r Web Services generalize this model so that computers can talk to computers using much of the same protocols used to communicate between browsers and web servers + a lot more.
What are Web Services? r The concept of Web Service (WS) was introduced in 1999 by Hewlett-Packard. Microsoft coined the actual term “Web Services” in June 2000 as part of the. NET initiative. r Web services are often advertised as a new wave in business process automation m Is suppose to allow a seamless integration of systems and applications that communicate over the network and share data. This technology is in its infancy. r Work in progress m Unproven m Lots of hype?
What are Web Services? r Idea of treating software as a service. m Nothing new r Evolution of many different technologies m Remote Procedure Calls (RPC) m CORBA m DCOM m Java RMI r What is novel? m Overwhelming industry support m Utilization of XML
Why Web Services r SUN RPC, DEC, CORBA, DCOM, Java RMI m Not considered Internet-friendly m Interoperability issues: standards are not always clear. m Cannot be implemented in any language on any platform m Software components that comprise the application are often not useful except for that application r A web service m Can be implemented in any language on any platform m Black boxes • Component-like, reusable m Based on Web standards • HTTP, XML, SOAP, WSDL, UDDI
Examples of Simple Web Services r Return the distance in miles between 2 locations r Locate entertainment, restaurants and lodging in a given area r Return the name and the postal address associated with a given phone number. r Find ATM location for a given postal code. r Return stock quotes.
Examples of Web Services r A travel agent needs to book a flight, hotel and car in a warm place. The client wants the best prices. Travel agent contacts each airline for flight information, hotel chain for hotel information and car rental agencies. m The airlines, hotel chains and car rental agencies can be thought of as web services from the travel agent’s perspective. m The travel agent’s user may think of the travel agent as a web service.
Examples of Web Services r You should note the potential reusability of each of the services described on the last two slides. r Web services provide interoperability between various software applications running on various platforms. r Web services leverage open standards and protocols.
Web Services Architecture (2) Discover Services Service Directory Service Requestor (3) Invoke Services (1) Publish Service Provider
Web Services Architecture r Service Provider m Implements the Web Service and makes it available on the Internet r Service Requestor m Consumer of the Web Service r Service Directory m Logically centralized directory of services m Place to publish a new web service or find existing one.
XML r XML – Extensible Markup Language r Open standard for data exchange; for describing data which allows an infinite range of elements (tags) to be defined: m Tags define content m Separation of content from presentation
SOAP r SOAP – Simple Object Access Protocol m Created by Microsoft and submitted to W 3 C in 1999 m Multivendor support including IBM, Sun, Oracle, HP, etc; r SOAP operates as RPC mechanism with HTTP used as transport protocol. r Encodes requests and responses as XML documents. r SOAP is suppose to be simple, easy to extend and interoperable.
SOAP Elements r Envelope (mandatory) m Top element of the XML document representing the message r Header (optional) m Determines how a recipient of a SOAP message should process the message m Adds features to the SOAP message such as authentication, transaction management, payment, message routes, logging, auditing, etc… r Body (mandatory) m Exchanges information intended for the recipient of the message. m Typical use is for RPC calls and error reporting.
Soap Request SOAP-ENV: Envelope xmlns: SOAP-ENV="http: //schemas. xmlsoap. org/soap/envelope/" SOAPENV: encoding. Style="http: //schemas. xmlsoap. org/soap/encoding/"/> Identifies XML has SOAP message <SOAP-ENV: Body> <m: Get. Last. Trade. Price. Request xmlns: m="Some-URI"> <symbol>HP</symbol> </m: Get. Last. Trade. Price. Request> </SOAP-ENV: Body> </SOAP-ENV: Envelope>
Soap Request SOAP-ENV: Envelope xmlns: SOAP-ENV="http: //schemas. xmlsoap. org/soap/envelope/" SOAPENV: encoding. Style="http: //schemas. xmlsoap. org/soap/encoding/"/ > <SOAP-ENV: Body> <m: Get. Last. Trade. Price. Request xmlns: m="Some-URI"> <symbol>HP</symbol> </m: Get. Last. Trade. Price. Request> </SOAP-ENV: Body> </SOAP-ENV: Envelope> Get price for HP stock
SOAP Response <SOAP-ENV: Envelope xmlns: SOAPENV="http: //schemas. xmlsoap. org/soap/envelope/" SOAPENV: encoding. Style="http: //schemas. xmlsoap. org/soap/encoding/"/ > <SOAP-ENV: Body> <m: Get. Last. Trade. Price. Response xmlns: m="Some-URI"> <Price>34. 5</Price> </m: Get. Last. Trade. Price. Response> </SOAP-ENV: Body> </SOAP-ENV: Envelope>
WSDL r WSDL – Web Services Description Language r Type of XML used to describe abilities of Web Service to its potential user. r WSLD provides the standard method of describing web services and their specific capabilities to other applications.
Elements in WSDL Definitions r Types m Based on XML Schema type system r Message formats m Parts represent method parameters r Port Types m Set of operations m Parameter order m Input and output messages r Bindings m Map a Port Type to a specific protocol, using a specific data encoding style r Services m Set of ports that implement port types m Access point for each port
WSDL – An Example <definitions> <types> <!-- XML Schema --> </types> <message name=“get. Quote. Request” /> <message name=“get. Quote. Response” /> <port. Type name=“Stock. Quote. Service. Interface”> <operation name=“get. Quote”> <input message=“get. Quote. Request” /> <output message=“get. Quote. Response” /> Definition of data types Definition of messages Definition of port type Definition of the bindings </operation> </port. Type> <binding name=“Stock. Quote. Service. Binding” type=“Stock. Quote. Service. Interface”> <soap: binding transport=“http: //schemas. xmlsoap. org/soap/http” /> … </binding> Definition of the service <service name=“Stock. Quote. Service”> <port name=“Stock. Quote. Service. Port” binding=“Stock. Quote. Service. Binding”> <soap: address location=“http: //www. acme. com/services/stockquote” /> </port> </service> </definitions>
UDDI r UDDI – Universal Description, Discovery, and Integration r Enables the creation of searchable web service directory that allows for the registration of a service and in response to a user provide the location of a service. r Search by business or service type r Has a Web Services API for publishing and discovering the existence of Web services r A coalition of organizations working together to manage UDDI registries and to further develop the Web Services API for accessing those registries.
How UDDI Works 1. SW companies, standards bodies, and programmers populate the registry with descriptions of different types of services 2. UDDI Business Registry Businesses populate the registry with descriptions of the services they support 4. Marketplaces, search engines, and business apps query the registry to discover services at other companies Business Registrations 3. Assigns a unique identifier to each business registration 5. Business uses this data to facilitate easier integration with each other over the Web
Web Service Example(from SUN) r Suppose that the owner of a chain of coffee houses, called Coffee Break, wants to expand by selling coffee online. r The owner instructs the business manger to find some new coffee supplier, get their wholesale prices, and then arrange for orders to be placed as the need arises. r Coffee Break can analyze prices and decide which new coffees it wants to carry and which companies it wants to buy them from.
Web Services Example (from SUN) r Locate coffee supplier through a UDDI service directory. r The Coffee Break will issue a query to the UDDI service directory. When the search is completed, the registry will send back information on how to contact the wholesale coffee distributors that meet the criteria set out in the query.
Web Services Example r Now Coffee Break can request price lists from each of the coffee distributors returned by the UDDI Service Directory. m The Coffee Break has obtained a WSDL description for each distributor which describes the procedure to call to get prices and the URL where the request is to be sent. r Upon receiving the responses for the request for prices, Coffee Break processes the price lists. This is used to send orders.
Traditional RPC vs Web Services Traditional RPC r Within enterprise r Tied to a set of programming languages r Procedural r Usually bound to a particular transport r Tightly-coupled r Firewall-unfriendly r Efficient processing Web Services r Between enterprises r Program language independent r Message-driven r Easily bound to different transports r Loosely-coupled r Firewall-friendly r Relatively not efficient processing
Challenges r Standards are new and require further development as to make sure that there is true interoperability. r Lack of Security r Controversy over royalty fees (intellectual property rights to SOAP, WSDL, UDDI are held by Microsoft and IBM). r Management, monitoring, auditing r Performance: WS may be too slow for high performance applications since parsing XML takes time. r Quality of Service: Lack of standards describing quality of various web services.