ecommerce technology 20-751 lecture 14: web services
DESCRIPTION
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 - PowerPoint PPT PresentationTRANSCRIPT
20-751 ECOMMERCE TECHNOLOGY
SUMMER 2002
COPYRIGHT © 2002 MICHAEL I. SHAMOS
eCommerce Technology20-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
B2B Much More Complicated Than B2C
B2CB2C ChooseVendorChooseVendor
Select& OrderSelect
& OrderProcess
CreditCard
Process CreditCard
ShipShip
B2BB2B Review CatalogsReview
CatalogsIdentify
SpecificationsIdentify
SpecificationsSend RFP
Send RFP
Select VendorSelect Vendor
ApproveP.O.
ApproveP.O.
Set Up CreditSet Up Credit
Define Requirements
Define Requirements
Review VendorsReview Vendors
Fill Out P.O.
Fill Out P.O.
Send P.O. to VendorSend P.O. to Vendor
Letter of Credit / Terms
Letter of Credit / Terms
Prepare Fulfillment
Prepare Fulfillment
Generate P.O. Receipt
Generate P.O. Receipt
Check Availability
Check Availability
Send OrderSend Order
InspectionsInspections Receive Order
Receive Order
Prepare InvoicePrepare Invoice
Send InvoiceSend
Invoice
Receive Invoice / Prepare PaymentReceive Invoice / Prepare Payment
Arrange ShippingArrange Shipping Tariffs /
CustomsTariffs /
CustomsPost
PaymentPost
PaymentSend
CheckSend
Check
SOURCE: METALSITE
20-751 ECOMMERCE TECHNOLOGY
SUMMER 2002
COPYRIGHT © 2002 MICHAEL I. SHAMOS
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
ShoppingCart
TaxCalculation
ShippingCalculation
DiscountCalculation
Services may reside somewhere else, provided by someone else
20-751 ECOMMERCE TECHNOLOGY
SUMMER 2002
COPYRIGHT © 2002 MICHAEL I. SHAMOS
Web Services Example
BUYERSERVICE
SELLERSERVICE
OUT IN
IN OUT
1ORDER
3GOODS
CreditValidation
Service
2VALIDATE
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
SOURCE: HEATHER KREGER, IBM
20-751 ECOMMERCE TECHNOLOGY
SUMMER 2002
COPYRIGHT © 2002 MICHAEL I. SHAMOS
CreditValidationService
InventoryManagement
Service
CustomerAccounting
Service
IN OUT
BuyerService
SellerService
Private Flow
Public Flow
PublicCredit Service Step 1 Step 2 Step 3
Public v. Private Workflows
SOURCE: HEATHER KREGER, IBM
20-751 ECOMMERCE TECHNOLOGY
SUMMER 2002
COPYRIGHT © 2002 MICHAEL I. SHAMOS
Six Properties of a Web Service
• IBM definition:
– self-contained
– self-describing
– modular applications
– published
– located
– invoked across the web
object-oriented
WSDLWEB SERVICESDESCRIPTION LANGUAGE
UDDI UNIVERSAL DESCRIPTIONDISCOVERY AND INFORMATION
SOAP or XML-RPC
SIMPLE OBJECTACCESS PROTOCOL
XML REMOTEPROCEDURE CALL
SOURCE: OBJECTIVE SOLUTIONS
20-751 ECOMMERCE TECHNOLOGY
SUMMER 2002
COPYRIGHT © 2002 MICHAEL I. SHAMOS
UDDI Summary
UDDI Business Registry
3. UBR assigns a unique identifier to each service and business registration
Marketplaces, search engines, and business apps query the registry to discover services at other companies
4.
Service TypeRegistrations
Companies, standards bodies, and programmers populate the registry with descriptions of different types of services
1.
BusinessRegistrationsBusinesses
populate the registry withdescriptions of the services they support
2.
Business uses this data to facilitate easier integration with each other over the Web
5.
SOURCE: UDDI.ORG
WebServices Client
ClientFunction
Stub
Publishing and Using Web Services
UDDI Registry
White
Yellow
Green
WSDL Descriptions
WebService
WebServer
BusinessFunction
ApplicationServer
Find
ServiceDescription
(WSDL)
Publish
WSDL
Bind +Business Methods
Web Service Provider
SOURCE: HEATHER KREGER, IBM
Web Services In Action
WebService
Consumer Web
ServiceProvider
UDDI
http://myservice.com/service
XML/SOAP body
Let’s talk (SOAP)
http://myservice.com?wsdl
Service descriptions
How do we talk? (WSDL)
http://www.uddi.org
Link to WSDL document
Find a web service provider (UDDI)
SOURCE: SIMON HUTSON, KPMG
20-751 ECOMMERCE TECHNOLOGY
SUMMER 2002
COPYRIGHT © 2002 MICHAEL I. SHAMOS
Simple Web Services Workflow
BUYERSERVICE
SELLERSERVICE
OUT IN
IN OUT
ORDER
GOODS
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.
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
List
en
erXML Request
XML Response
Web Server
mid
dle
ware
BusinessService
WebService
SOURCE: OBJECTIVE SOLUTIONS
HTTP
HTTP
• Web services are invoked by sending text files over HTTP
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
Clientapplication
Web
server
UDDIregistrynode
SOAPprocessor
UDDI registryservice
UDDIdatabase
SOAP request
SOAP response
SOURCE: OBJECTIVE SOLUTIONS
MACHINEMACHINE
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: xSchema definition of data
Port Types
Service
Port
Binding
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
Port Types
Service
Port
Binding
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
Port Types
Service
Port
Binding
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
Port Types
Service
Port
Binding
Operations
Messages
Types
<portType name="StockQuotePortType"><operation name="GetLastTradePrice">
<input message="tns:GetLastTradePriceInput"/><output message="tns:GetLastTradePriceOutput"/>
</operation></portType>
Maps Operations to Messages
SOURCE: FRANK ROBINSON. SILVERSTREAM
Binding: Maps Protocols to Methods
Port Types
Service
Port
Binding
Operations
Messages
Types
<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>
SOURCE: FRANK ROBINSON. SILVERSTREAM
Port: Maps URLs to Methods
Port Types
Service
Port
Binding
Operations
Messages
Types
<port name="StockQuotePort" binding="tns:StockQuoteBinding"><soap:address location="http://example.com/stockquote"/>
</port>
SOURCE: FRANK ROBINSON. SILVERSTREAM
Service: Packages Ports & Bindings
Port Types
Service
Port
Binding
Operations
Messages
Types
<service name="StockQuoteService"><documentation>My first service</documentation><port name="StockQuotePort"
binding="tns:StockQuoteBinding"><soap:address
location="http://example.com/stockquote"/></port>
</service>
SOURCE: FRANK ROBINSON. SILVERSTREAM
20-751 ECOMMERCE TECHNOLOGY
SUMMER 2002
COPYRIGHT © 2002 MICHAEL I. SHAMOS
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
SOAP EnvelopeSOAP Envelope(SOAP grammar) (SOAP grammar)
Application Application MessageMessage(Application-Specific (Application-Specific grammar) grammar)
SOURCE: JEZ WAIN, BULL
20-751 ECOMMERCE TECHNOLOGY
SUMMER 2002
COPYRIGHT © 2002 MICHAEL I. SHAMOS
POST /weather HTTP/1.1Host: www.meteo.frContent-Type: text/xmlContent-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>
Standard
http HeaderSOAP header
Extensions
Xml
Payload
SOAP Request
SOURCE: JEZ WAIN, BULL
20-751 ECOMMERCE TECHNOLOGY
SUMMER 2002
COPYRIGHT © 2002 MICHAEL I. SHAMOS
SOAP – Writing a Servicepackage 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
MessageSender
SubscriberList
publishMessage
NotificationService
APIs: publishMessage() subscribe() unsubscribe() …
MessageSubscriber
Service
subscribeunsubscribe
receiveMessage
Topic Subscriber Reference
WS\A\B <wsdlURL>#<port>
WS\C\D <wsdlURL>#<port>
… …
SOURCE: IDC
…Service
Example: Utility Services
BusinessService
ServiceRequestor
IdentityHandler
IdentityService
IdentityServlet
DigSigSOAPMessage
ContractHandler
ContractService Message
LoggingServiceCheck
UsageContract
All PublishedMessages
CommonData
Service
Create,Update,QueryData
Store IdentityKeyIn MessageContext
…ServiceXXX
Service
MeteringService
RecordMeter Event
MeteringRequestHandler
MeteringResponseHandler
NotificationService
AccountingService
Get MeterEvents
DriveDemo
DigSigHandler
Provisioning Service UIGenerate
Report
IdentityCheck
RegisterSubscribe
Provisioning Service UI
SOURCE: IDC
20-751 ECOMMERCE TECHNOLOGY
SUMMER 2002
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 timeSOURCE: IDC
20-751 ECOMMERCE TECHNOLOGY
SUMMER 2002
COPYRIGHT © 2002 MICHAEL I. SHAMOS
Timeline for Web Services Adoption
Within thefirewall
Simplif
ied applicatio
n inte
gratio
n
Incre
ased develo
per pro
ductivity
Simplif
ied busin
ess partn
er connectiv
ity
Richer applic
ation fu
nctionalit
y
Subscriptio
n-based serv
ices
Casual/ad-h
oc use o
f serv
ices
New busin
ess models p
ossible
Pervasive u
se in n
on-traditi
onal devices
Comm
oditiza
tion o
f softw
are
Containedexternalusers
2002 2004
Fully dynamic search & use2006 2008
SOURCE: IDC