e Commerce Technology 20 751 Lecture 14 Web
e. Commerce Technology 20 -751 Lecture 14: Web Services
Machine-to-Machine M 2 M 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)
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
B 2 B Much More Complicated Than B 2 C Choose Vendor B 2 C B 2 B Review Catalogs Identify Specifications Define Requirements Send RFP Ship Select Vendor Approve P. O. Fill Out P. O. Review Vendors Prepare Fulfillment Letter of Credit / Terms Process Credit Card Select & Order Set Up Credit Send P. O. to Vendor Check Availability Generate P. O. Receipt Send Invoice Send Order Arrange Shipping Inspections Tariffs / Customs 20 -751 ECOMMERCE TECHNOLOGY Receive Order Post Payment SUMMER 2002 Prepare Invoice Receive Invoice / Prepare Payment Send Check COPYRIGHT © 2002 MICHAEL I. SHAMOS 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
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 p p 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 Public Credit Service Credit Validation 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 web SOAP or XML-RPC the 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 Client Function WSDL Stub Web. Services Client 20 -751 ECOMMERCE TECHNOLOGY Bind + Business Methods SUMMER 2002 Web Service Business Function Web Server Application Server COPYRIGHT © 2002 MICHAEL I. SHAMOS 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) Web Service Provider http: //myservice. com/service XML/SOAP body 20 -751 ECOMMERCE TECHNOLOGY SUMMER 2002 SOURCE: SIMON HUTSON, KPMG COPYRIGHT © 2002 MICHAEL I. SHAMOS
Simple Web Services Workflow p A Buyer Service is ordering goods from a Seller Service. p The Seller Service interface is defined using WSDL. p p 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
Types: x. Schema definition of data Service Port Binding Port Types Operations Messages Types <types> <schema target. Namespace="http: //example. com/stockquote. xsd" xmlns="http: //www. w 3. org/2000/10/XMLSchema"> <element name="Trade. Price. Request"> <complex. Type> <element name="ticker. Symbol" type="string"/> </complex. Type> </element> <element name="Trade. Price"> <complex. Type> <element name="price" type="float"/> </complex. Type> </element> </schema> </types> 20 -751 ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS SOURCE: FRANK ROBINSON. SILVERSTREAM
Messages: Collections of Types Service Port Binding Port Types Operations Messages Types <message name="Get. Last. Trade. Price. Input"> <part name="body" element="xsd 1: Trade. Price. Request"/> </message> <message name="Get. Last. Trade. Price. Output"> <part name="body" element="xsd 1: Trade. Price"/> </message> 20 -751 ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS SOURCE: FRANK ROBINSON. SILVERSTREAM
Operations: Available Methods Service Port Binding Port Types Operations Messages Types <operation name="Get. Last. Trade. Price"> <soap: operation soap. Action="http: //example. com/Get. Last. Trade. Price"/> <input> <soap: body use="literal"/> </input> <output> <soap: body use="literal"/> </output> </operation> 20 -751 ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS SOURCE: FRANK ROBINSON. SILVERSTREAM
Port Types: XML Method I/O Service Maps Operations to Messages Port Binding Port Types Operations <port. Type name="Stock. Quote. Port. Type"> <operation name="Get. Last. Trade. Price"> <input message="tns: Get. Last. Trade. Price. Input"/> <output message="tns: Get. Last. Trade. Price. Output"/> </operation> </port. Type> Messages Types 20 -751 ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS SOURCE: FRANK ROBINSON. SILVERSTREAM
Binding: Maps Protocols to Methods Service Port Binding Port Types Operations Messages <binding name="Stock. Quote. Soap. Binding“ type="tns: Stock. Quote. Port. Type"> <soap: binding style="document“ transport="http: //schemas. xmlsoap. org/soap/http"/> <operation name="Get. Last. Trade. Price"> <soap: operation soap. Action="http: //example. com/Get. Last. Trade. Price"/> <input> <soap: body use="literal"/> </input> <output> <soap: body use="literal"/> </output> </operation> </binding> Types 20 -751 ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS SOURCE: FRANK ROBINSON. SILVERSTREAM
Port: Maps URLs to Methods Service Port <port name="Stock. Quote. Port" binding="tns: Stock. Quote. Binding"> <soap: address location="http: //example. com/stockquote"/> </port> Binding Port Types Operations Messages Types 20 -751 ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS SOURCE: FRANK ROBINSON. SILVERSTREAM
Service: Packages Ports & Bindings Service Port <service name="Stock. Quote. Service"> <documentation>My first service</documentation> <port name="Stock. Quote. Port" binding="tns: Stock. Quote. Binding"> <soap: address location="http: //example. com/stockquote"/> </port> </service> Binding Port Types Operations Messages Types 20 -751 ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS 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#get. Weather Extensions <SOAP: Envelope xmlns: SOAP="urn: schemas-xmlsoaporg: soap. v 1. 1"> <SOAP: Body> <m: get. Weather xmlns: m=”meteo. xsd"> <location>Grenoble</location> </m: get. Weather> 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 Meteo. Server { public Meteo. Server() { private Hash. Map weathermap = new Hash. Map; weathermap. put(“Grenoble”, “sunny and warm”); weathermap. put(“London”, “cold and wet”); } public String get. Weather(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 publish. Message subscribe unsubscribe receive. Message Subscriber List APIs: publish. Message() subscribe() unsubscribe() … Topic Message Subscriber Service Subscriber Reference WSAB <wsdl. URL>#<port> WSCD <wsdl. URL>#<port> … … SOURCE: IDC 20 -751 ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS
Example: Utility Services … … XXX Service Register Subscribe Drive Demo Identity Service Requestor Identity Check Dig. Sig Handler Identity Servlet Check Usage Contract Identity Handler Contract Handler 20 -751 ECOMMERCE TECHNOLOGY Notification Service Message Logging All Published Service Messages Metering Request Handler Store Identity. Key In Message. Context Dig. Sig SOAP Message SOURCE: IDC Contract Service Provisioning Service UI Business Service Metering Response Handler Record Meter Event Get Metering Events Service SUMMER 2002 Generate Report Create, Update, Query Data Common Data Service Provisioning Service UI Accounting Service COPYRIGHT © 2002 MICHAEL I. SHAMOS
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 ty i v ti v c e e n y n ld it o ivit on ity a e s ibl n l a ct c e e s o r a i r r c vi oss twa dit eg du tne tion vice t r e p of tra r in pro ar nc s e s f el n r p fu s s n o o f s n d o ti pe d o e s e n a o s e n in u ic elo in tio bas m o l i c ss s ca t se p ev o a u p n i l a d b p -h ine itiz e u io t d d p p d iv e e e /a us o l il fi as il fi er a cri a b m vas s u p re p h s ew om er b m nc m ic a u i i N R C S S I P S C 2002 Within the firewall 2004 Contained external users 2006 s e ic 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
- Slides: 35