Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
eCommerce Technology 20-751 Lecture 14: Web Services 20-751 ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS Machine-to-Machine M2M Commerce • There are more machines than people • Machines are always becoming more functional (Moore’s law) • Intelligent agents exist • More commerce will be occur between machines than between people • Commerce machines must discover each other and be able to do business (common language) 20-751 ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS Human Web v. Transactional Web • They’re the same hardware, different software • WWW was designed to be accessed by humans – browsers • Protocols needed to allow machines to access information • Need to run software resident on other systems and networks 20-751 ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS B2B Much More Complicated Than B2C Choose Vendor B2C B2B Review Catalogs Identify Specifications Define Requirements Letter of Credit / Terms Process Credit Card Select & Order Send RFP Select Vendor Approve P.O. Fill Out P.O. Review Vendors Prepare Fulfillment Ship Set Up Credit Send P.O. to Vendor Generate P.O. Receipt Check Availability Send Invoice Send Order Inspections Receive Order Prepare Invoice Receive Invoice / Prepare Payment Arrange Shipping Tariffs / Customs Post Payment Send Check SOURCE: METALSITE Web Services • Self-contained, self-describing applications • Created using familiar programming languages (Java) • Published, located and invoked over the Web using Web service interface standards • By machines • Function may be very simple or very complicated • Examples: – – – – a foreign currency converter stock quotations, analysis product recommender agent freight forwarder 20-751 ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS Example: Shopping Cart Checkout Discount Calculation Shopping Cart Tax Calculation Services may reside somewhere else, provided by someone else Shipping Calculation 20-751 ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS Web Services Example A Buyer Service is ordering goods from a Seller Service. The Seller Service may need to use other web services to accept and process the order 2 VALIDATE Credit Validation Service 1 ORDER OUT IN BUYER SERVICE SELLER SERVICE IN OUT 3 GOODS SOURCE: HEATHER KREGER, IBM 20-751 ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS Public v. Private Workflows Buyer Service Seller Service Public Flow Private Flow IN Credit Validation Service Public Credit Service Inventory Management Service Customer Accounting Service OUT Step 1 Step 2 Step 3 SOURCE: HEATHER KREGER, IBM 20-751 ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS Six Properties of a Web Service • IBM definition: object-oriented – self-contained – self-describing – modular applications – published WSDL WEB SERVICES DESCRIPTION LANGUAGE – located UDDI UNIVERSAL DESCRIPTION DISCOVERY AND INFORMATION – invoked across the web SOAP or XML-RPC SOURCE: OBJECTIVE SOLUTIONS 20-751 ECOMMERCE TECHNOLOGY SIMPLE OBJECT ACCESS PROTOCOL SUMMER 2002 XML REMOTE PROCEDURE CALL COPYRIGHT © 2002 MICHAEL I. SHAMOS UDDI Summary 1. 4. Companies, standards bodies, and programmers populate the registry with descriptions of different types of services Marketplaces, search engines, and business apps query the registry to discover services at other companies 2. UDDI Business Registry Businesses populate the registry with descriptions of the services they support Business Registrations 5. Service Type Registrations 3. UBR assigns a unique identifier to each service and business registration SOURCE: UDDI.ORG 20-751 ECOMMERCE TECHNOLOGY SUMMER 2002 Business uses this data to facilitate easier integration with each other over the Web COPYRIGHT © 2002 MICHAEL I. SHAMOS Publishing and Using Web Services UDDI Registry Service Description (WSDL) White Yellow WSDL Descriptions Web Service Provider Publish Green Find Web Service Business Function Web Server Application Server WSDL Client Function Stub WebServices Client Bind + Business Methods SOURCE: HEATHER KREGER, IBM Web Services In Action Find a web service provider (UDDI) http://www.uddi.org UDDI Link to WSDL document Web Service Consumer How do we talk? (WSDL) http://myservice.com?wsdl Service descriptions Let’s talk (SOAP) http://myservice.com/service XML/SOAP body SOURCE: SIMON HUTSON, KPMG Web Service Provider Simple Web Services Workflow A Buyer Service is ordering goods from a Seller Service. The Seller Service interface is defined using WSDL. Buyer Service invokes the “order” method on the seller service using SOAP and the WSDL definition for the seller service. The Buyer Service knows what to expect in the SOAP reply message. This is defined in the Seller Service WSDL. ORDER OUT IN BUYER SERVICE SELLER SERVICE IN OUT GOODS SOURCE: HEATHER KREGER, IBM 20-751 ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS Architectural Overview • Web service is a standards-based façade • Wrapper for accessing non-standardized applications HTTP XML Response Web Service HTTP middleware XML Request Listener Web Server Business Service • Web services are invoked by sending text files over HTTP SOURCE: OBJECTIVE SOLUTIONS 20-751 ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS Invoking a Web Service • • • • Client queries a UDDI registry node Server returns a list of records matching request Client identifies a specific service of interest Server “binds” client to the service so client can invoke the methods of the service MACHINE Client application MACHINE SOAP processor Web server UDDI registry service SOAP request SOAP response UDDI registry node UDDI database SOURCE: OBJECTIVE SOLUTIONS 20-751 ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS Simple Object Access Protocol (SOAP) • • • • • • SOAP demo UDDI demo Amazon search Google search Digital signature demo xmethods.com 20-751 ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS Types: xSchema definition of data Service Port Binding Port Types Operations Messages Types <types> <schema targetNamespace="http://example.com/stockquote.xsd" xmlns="http://www.w3.org/2000/10/XMLSchema"> <element name="TradePriceRequest"> <complexType> <element name="tickerSymbol" type="string"/> </complexType> </element> <element name="TradePrice"> <complexType> <element name="price" type="float"/> </complexType> </element> </schema> </types> SOURCE: FRANK ROBINSON. SILVERSTREAM Messages: Collections of Types Service Port Binding Port Types Operations Messages Types <message name="GetLastTradePriceInput"> <part name="body" element="xsd1:TradePriceRequest"/> </message> <message name="GetLastTradePriceOutput"> <part name="body" element="xsd1:TradePrice"/> </message> SOURCE: FRANK ROBINSON. SILVERSTREAM Operations: Available Methods Service Port Binding Port Types Operations Messages Types <operation name="GetLastTradePrice"> <soap:operation soapAction="http://example.com/GetLastTradePrice"/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> SOURCE: FRANK ROBINSON. SILVERSTREAM Port Types: XML Method I/O Service Maps Operations to Messages Port Binding Port Types Operations <portType name="StockQuotePortType"> <operation name="GetLastTradePrice"> <input message="tns:GetLastTradePriceInput"/> <output message="tns:GetLastTradePriceOutput"/> </operation> </portType> Messages Types SOURCE: FRANK ROBINSON. SILVERSTREAM Binding: Maps Protocols to Methods Service Port Binding Port Types Operations Messages <binding name="StockQuoteSoapBinding“ type="tns:StockQuotePortType"> <soap:binding style="document“ transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="GetLastTradePrice"> <soap:operation soapAction="http://example.com/GetLastTradePrice"/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> </binding> Types SOURCE: FRANK ROBINSON. SILVERSTREAM Port: Maps URLs to Methods Service Port <port name="StockQuotePort" binding="tns:StockQuoteBinding"> <soap:address location="http://example.com/stockquote"/> </port> Binding Port Types Operations Messages Types SOURCE: FRANK ROBINSON. SILVERSTREAM Service: Packages Ports & Bindings Service Port <service name="StockQuoteService"> <documentation>My first service</documentation> <port name="StockQuotePort" binding="tns:StockQuoteBinding"> <soap:address location="http://example.com/stockquote"/> </port> </service> Binding Port Types Operations Messages Types SOURCE: FRANK ROBINSON. SILVERSTREAM Web Service Definition Language (WSDL) • A WSDL file contains details in XML about provider (server) services • For each service, WSDL describes the set of allowed operations • For each operation, WSDL describes the formats of messages exchanged between the requesting consumer (client) and the provider (server) – to request the service; and – to interpret the results (output) of the service SOURCE: ELIOT CHRISTIAN, USGS 20-751 ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS WSDL Contains Details About Services SOURCE: ELIOT CHRISTIAN, USGS 20-751 ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS WSDL Contains Details About Operations SOURCE: ELIOT CHRISTIAN, USGS 20-751 ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS WSDL Contains Details About Messages SOURCE: ELIOT CHRISTIAN, USGS 20-751 ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS SOAP Mechanisms • Request and Response messages – request invokes a method on a remote object – response returns the result of the method execution • Messages wrapped in a SOAP envelope – SOAP envelope is an XML grammar – Message grammar is different from envelope Application Message (Application-Specific grammar) SOAP Envelope (SOAP grammar) SOURCE: JEZ WAIN, BULL 20-751 ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS SOAP Request POST /weather HTTP/1.1 Standard Host: www.meteo.fr Content-Type: text/xml http Header Content-Length: <nnn> SOAP header SOAPAction: http://www.meteo.fr/meteo#getWeather Extensions <SOAP:Envelope xmlns:SOAP="urn:schemas-xmlsoaporg:soap.v1.1"> <SOAP:Body> <m:getWeather xmlns:m=”meteo.xsd"> <location>Grenoble</location> </m:getWeather> Xml Payload </SOAP:BODY> </SOAP:Envelope> SOURCE: JEZ WAIN, BULL 20-751 ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS SOAP – Writing a Service package meteo; public class MeteoServer { public MeteoServer() { private HashMap weathermap = new HashMap; weathermap.put(“Grenoble”, “sunny and warm”); weathermap.put(“London”, “cold and wet”); } public String getWeather(String location) { String weather; if ((weather = (String)weathermap.get(location))!= null) { return new String(“the weather in “ + location + “ is “ + weather + “ as usual”); } else { return new String(“Can’t find “ + location + “ on the map”); }}} SOURCE: JEZ WAIN, BULL 20-751 ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS Example: Notification Service Message Sender Notification Service publishMessage subscribe unsubscribe Message Subscriber Service receiveMessage Subscriber List APIs: publishMessage() subscribe() unsubscribe() … Topic Subscriber Reference WS\A\B <wsdlURL>#<port> WS\C\D <wsdlURL>#<port> … … SOURCE: IDC 20-751 ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS Example: Utility Services … … XXX Service Service Service Register Subscribe Drive Demo Identity Service Service Requestor Identity Check DigSig Handler Identity Servlet DigSig SOAP Message Contract Service Check Usage Contract Identity Handler Contract Handler Notification Service Message Logging All Published Service Messages Metering Request Handler Store IdentityKey In MessageContext Business Service Create, Update, Query Data Common Data Service Metering Response Handler Record Meter Event Metering Service SOURCE: IDC Provisioning Service UI Generate Report Get Meter Events Accounting Service Provisioning Service UI Web Services Vision • Applications become process flow & event management • Processes are just sets of object method invocations • Object can: – – – – Exist anywhere Be owned by anyone Be developed anyhow Execute on any platform • Applications use methods as needed – Discover them through UDDI – Negotiate their use dynamically – Bind to & execute them in real time SOURCE: IDC 20-751 ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS Timeline for Web Services Adoption 2002 Within the firewall 2004 Contained external users 2006 2008 Fully dynamic search & use SOURCE: IDC 20-751 ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS Q&A 20-751 ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS