Web Services
E N D
Presentation Transcript
Web Services Part 1 -- Qinwei Zhu Part 2 – Yongqun He
What Are Web Services? • Web services are a new breed of Web application. They are self-contained, self-describing, modular applications that can be published, located, and invoked across the Web.
Why we use Web Services? • The Web provides a uniform and widely accessible interface and access glue over services. • Web service providers can use the Internet to market their services to a potentially huge set of possible clients. • For clients, it can mean quicker and more flexible application development.(all the wording)
Examples of Web Services • Microsoft Passport: a convenient authentication service used in Hotmail • A credit checking service that returns credit information when given a person's social security number. • A stock quote service that returns the stock price associated with a specified ticker symbol.
Web Services Platform = XML + HTTP Or = XML + HTTP + SOAP + WSDL + UDDL Or = XML + HTTP + SOAP + WSDL + UDDL +XAML + XLANG + XFS +……
SOAP • Simple Object Access Protocol – is a protocol specification that defines a uniform way of passing XML-encoded data • SOAP envelop • SOAP header • SOAP body
POST /StockQuote HTTP/1.1 Host: www.stockquoteserver.com Content-Type: text/xml; charset="utf-8" Content-Length: nnnn SOAPAction: "Some-URI" <SOAP-ENV:Envelope xmlns:SOAP-ENV=http://schemas.xmlsoap.org/soap/envelope/ SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <m:GetLastTradePrice xmlns:m="Some-URI"> <symbol>DIS</symbol> </m:GetLastTradePrice> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
HTTP/1.1 200 OK Content-Type: text/xml; charset="utf-8" Content-Length: nnnn <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> <SOAP-ENV:Body> <m:GetLastTradePriceResponse xmlns:m="Some-URI"> <Price>34.5</Price> </m:GetLastTradePriceResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
UDDI • Universal Description, Discovery and Integration – provides a mechanism for clients to dynamicaly find other web services
UDDI • White pages: Information such as the name, address, telephone number, and other contact information of a given business. • Yellow pages: Information that categorizes businesses. This is based on existing(non-electronic) standards. • Green pages: Technical information about the Web services provided by a given business.
Registry APIs (SOAP Messages) • Publishers API • Save things • save_business • save_service • save_binding • save_tModel • Delete things • delete_business • delete_service • delete_binding • delete_tModel • security… • get_authToken • discard_authToken • Inquiry API • Find things • find_business • find_service • find_binding • find_tModel • Get Details about things • get_businessDetail • get_serviceDetail • get_bindingDetail • get_tModelDetail
e.g.1 <find_business generic="2.0" xmlns=um:uddi-org:api-v2"> <name>Books%</name> </find_business> e.g.2 (?) ( and return result……) <get_serviceDetail generic="2.0" xmlns=um:uddi-org:api-v2"> <serviceKey>"2AB346C0-2282-43B0-756B-0003CC35CC1D“ </name> </get_serviceDetail>
<tModel authorizedName="..." operator="..." tModelKey="..."> <name>StockQuote Service</name> <description xml:lang="en"> WSDL description of a standard stock quote service interface </description> <overviewDoc> <description xml:lang="en">WSDL source document. </description> <overviewURL> http://stockquote-definitions/stq.wsdl </overviewURL> </overviewDoc> <categoryBag> <keyedReference tModelKey="uuid:C1ACF26D-9672-4404-9D70-39B756E62AB4" keyName="uddi-org:types" keyValue="wsdlSpec"/> </categoryBag> </tModel>
WSDL • Web Services Description Language • Service – a collection of ports • Port – a single endpoint defined as a combination of a binding and a network address • Binding – a concrete protocol and data format specification for particular port type • Port type – an abstract set of operations supported by one or more endpoints • Operation – an abstraction description of an action • And so on…
WSDL • There are tools available to read a WSDL file and generate the code required to communicate with an XML web service • Apache AXIS: generating Java stubs/skeletons given a WSDL file • Microsoft Visual Studio .NET
References • http://www.uddi.org • http://java.sun.com/webservices/ • http://www.xml.com/lpt/a/2001/04/04/webservices/index.html • http://www-106.ibm.com/developerworks/webservices/