350 likes | 426 Views
eCommerce Technology 20-751 Lecture 14: Web Services. 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
E N D
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)
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
B2B Much More Complicated Than B2C Process CreditCard ChooseVendor Select& Order B2C Ship Review Catalogs IdentifySpecifications Send RFP Select Vendor ApproveP.O. Set Up Credit B2B Define Requirements Fill Out P.O. Send P.O. to Vendor Review Vendors Check Availability Generate P.O. Receipt Prepare Fulfillment Letter of Credit / Terms Send Invoice Prepare Invoice Receive Order Send Order Inspections Receive Invoice / Prepare Payment Arrange Shipping Post Payment Send Check Tariffs / Customs 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
2 VALIDATE Credit Validation Service 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 1 ORDER BUYER SERVICE OUT IN SELLER SERVICE IN OUT 3 GOODS SOURCE: HEATHER KREGER, IBM
Buyer Service Seller Service Public Flow Private Flow Customer Accounting Service Credit Validation Service Inventory Management Service IN OUT Public Credit Service Step 1 Step 2 Step 3 Public v. Private Workflows SOURCE: HEATHER KREGER, IBM
object-oriented WEB SERVICESDESCRIPTION LANGUAGE WSDL UNIVERSAL DESCRIPTION DISCOVERY AND INFORMATION UDDI SOAP or XML-RPC SIMPLE OBJECT ACCESS PROTOCOL XML REMOTE PROCEDURE CALL Six Properties of a Web Service • IBM definition: • self-contained • self-describing • modular applications • published • located • invoked across the web SOURCE: OBJECTIVE SOLUTIONS
4. Marketplaces, search engines, and business apps query the registry to discover services at other companies 2. 5. BusinessRegistrations Businesses populate the registry with descriptions of the services they support Business uses this data to facilitate easier integration with each other over the Web 3. UBR assigns a unique identifier to each service and business registration UDDI Summary 1. Companies, standards bodies, and programmers populate the registry with descriptions of different types of services UDDI Business Registry Service Type Registrations SOURCE: UDDI.ORG
UDDI Registry Service Description(WSDL) White WSDL Descriptions Yellow Publish Green WebService BusinessFunction Find Web Server Application Server Client Function Stub Bind + Business Methods WebServices Client Publishing and Using Web Services Web Service Provider WSDL SOURCE: HEATHER KREGER, IBM
http://www.uddi.org Link to WSDL document http://myservice.com?wsdl Service descriptions http://myservice.com/service XML/SOAP body Web Services In Action Web Service Consumer UDDI Find a web service provider (UDDI) Web Service Provider How do we talk? (WSDL) Let’s talk (SOAP) SOURCE: SIMON HUTSON, KPMG
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 BUYER SERVICE OUT IN SELLER SERVICE IN OUT GOODS SOURCE: HEATHER KREGER, IBM
Architectural Overview • Web service is a standards-based façade • Wrapper for accessing non-standardized applications Web Server XML Request HTTP Web Service Business Service Listener middleware XML Response HTTP • Web services are invoked by sending text files over HTTP SOURCE: OBJECTIVE SOLUTIONS
SOAP request SOAP response SOAP processor UDDI registry service UDDI database 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 MACHINE Web server Client application UDDIregistrynode SOURCE: OBJECTIVE SOLUTIONS
Simple Object Access Protocol (SOAP) • SOAP demo • UDDI demo • Amazon search • Google search • Digital signature demo • xmethods.com
Types: xSchema definition of data Service Port Binding <types> <schema targetNamespace="http://example.com/stockquote.xsd" xmlns="http://www.w3.org/2000/10/XMLSchema"> <elementname="TradePriceRequest"> <complexType> <elementname="tickerSymbol" type="string"/> </complexType> </element> <element name="TradePrice"> <complexType> <element name="price" type="float"/> </complexType> </element> </schema> </types> Port Types Operations Messages Types SOURCE: FRANK ROBINSON. SILVERSTREAM
Messages: Collections of Types Service Port Binding Port Types Operations <message name="GetLastTradePriceInput"> <part name="body" element="xsd1:TradePriceRequest"/> </message> <message name="GetLastTradePriceOutput"> <part name="body" element="xsd1:TradePrice"/> </message> Messages Types SOURCE: FRANK ROBINSON. SILVERSTREAM
Operations: Available Methods Service Port Binding Port Types Operations <operation name="GetLastTradePrice"> <soap:operation soapAction="http://example.com/GetLastTradePrice"/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> Messages Types SOURCE: FRANK ROBINSON. SILVERSTREAM
Port Types: XML Method I/O Maps Operations toMessages Service Port Binding Port Types <portType name="StockQuotePortType"> <operation name="GetLastTradePrice"> <input message="tns:GetLastTradePriceInput"/> <output message="tns:GetLastTradePriceOutput"/> </operation> </portType> Operations Messages Types SOURCE: FRANK ROBINSON. SILVERSTREAM
Binding: Maps Protocols to Methods Service Port <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> Binding Port Types Operations Messages Types SOURCE: FRANK ROBINSON. SILVERSTREAM
Port: Maps URLs to Methods Service <port name="StockQuotePort" binding="tns:StockQuoteBinding"> <soap:address location="http://example.com/stockquote"/> </port> Port Binding Port Types Operations Messages Types SOURCE: FRANK ROBINSON. SILVERSTREAM
Service: Packages Ports & Bindings Service <service name="StockQuoteService"> <documentation>My first service</documentation> <port name="StockQuotePort" binding="tns:StockQuoteBinding"> <soap:address location="http://example.com/stockquote"/> </port> </service> Port 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
WSDL Contains Details About Services SOURCE: ELIOT CHRISTIAN, USGS
WSDL Contains Details About Operations SOURCE: ELIOT CHRISTIAN, USGS
WSDL Contains Details About Messages SOURCE: ELIOT CHRISTIAN, USGS
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
POST /weather HTTP/1.1 Host: www.meteo.fr Content-Type: text/xml Content-Length: <nnn> SOAPAction: http://www.meteo.fr/meteo#getWeather <SOAP:Envelope xmlns:SOAP="urn:schemas-xmlsoap-org:soap.v1.1"> <SOAP:Body> <m:getWeather xmlns:m=”meteo.xsd"> <location>Grenoble</location> </m:getWeather> </SOAP:BODY> </SOAP:Envelope> Standardhttp Header SOAP headerExtensions XmlPayload SOAP Request SOURCE: JEZ WAIN, BULL
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
Example: Notification Service subscribe unsubscribe Message Subscriber Service Message Sender Notification Service publishMessage receiveMessage Subscriber List APIs: publishMessage() subscribe() unsubscribe() … SOURCE: IDC
Example: Utility Services … Service … Service XXX Service Register Subscribe Notification Service Provisioning Service UI Drive Demo Identity Service Contract Service Message Logging Service Service Requestor Check Usage Contract All Published Messages Identity Check DigSig Handler Identity Handler Contract Handler Metering Request Handler Create, Update, Query Data Store IdentityKey In MessageContext Identity Servlet Business Service Common Data Service DigSig SOAP Message Metering Response Handler Provisioning Service UI Record Meter Event Generate Report Metering Service Accounting Service Get Meter Events SOURCE: IDC
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
Pervasive use in non-traditional devices Simplified business partner connectivity Simplified application integration Increased developer productivity Richer application functionality New business models possible Casual/ad-hoc use of services Commoditization of software Subscription-based services Fully dynamic search & use Contained external users Within the firewall 2002 2004 2006 2008 Timeline for Web Services Adoption SOURCE: IDC
Q A &