Date post: | 25-Dec-2015 |
Category: |
Documents |
Upload: | cameron-mcdonald |
View: | 215 times |
Download: | 1 times |
Aug 4, 2003
© Mark Gaynor, George Wyner, Bala Iyer, and Jim
Freedman 2003 AMCIS 2003
TutorialIntroduction to Web
ServicesBy
Mark GaynorBoston University
School of Management
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Agenda
What is a web service? Nobody really agrees! “Using XML and SOAP to access distributed
computing resources” – a good starting point Why are they good – interoperability is
valuable Web services architecture
Expose business logic to other applications Business implications
Is this what we have been waiting for? How about EDI, we were waiting for this also
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
What is a web service? (1)
Loosely coupled, reusable software components that semantically encapsulate discrete functionality and are distributed and programmatically accessible over standard Internet protocols” (Sleeper 2001).
Not so good – web services can have different degrees of coupling
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Tight vs. Loose Coupling
Tight coupling Very efficient interaction Very compressed
communication Requires “deep
knowledge”Loose coupling Less efficient interaction Not as many subtle
details conveyed Does not require “deep
knowledge”
BUStudent
Prof.Bala
Bala, course,F02
IS323
BUStudent
Prof.
Bala
Hay Bala, what course are you
teaching?
Now I am teaching a course about
using information …..
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
What is a web service? (2)
First take: a replacement for “form scraping” Second take: Software component (module)
Platform independent – Maybe (ask Microsoft) Language independent – Maybe (ask Sun) Implementation independent Available over a network
Can be easily discovered and learned about Can be easily invoked
May be composed with other services
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
What is a web service
A component with distributed access based on Internet standards
A definable piece of business logic for internal or external use
Web services Yellow Pages
Traffic-service
Time-service
Weather-service
Client
Weather-service
Directions for use
SOAP message
Temp for:Cambridge
MA
SOAP message
Temp is:91.5F
XML:XML:
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Example
Authentication of user: Client
Credit card verification: Client
Credit card verificationweb service
Authentication of usersweb service
Online shopping application
Web (soap) Services ServerWeb Server
WAN
Credit card verification
&Authentication of
user: Client
Credit card verification&
Authentication of usersweb service
WAN
SOAP
SOAP
SOAP
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Why Web Services?
Standardized distributed computing environments create value The more users, the greater the value
Dynamic Business Networks require Dynamic Information Systems From a technical point of view web
services allow this Common acceptance of a single
standard allows the politics to work
Stakeholder Views of Web Services
Architect Builder End-user
Web ServiceArchitectures
Web ServiceArchitectures
Web ServiceProducts
Web ServiceProducts
Web ServiceApplications
Web ServiceApplications
Componentrequirements
designprinciples,component
requirements)Requests
Design principles,Component requirements
& interfaces
Application Build-out& integration
Results
Owner
Web ServiceCapabilities
Web ServiceCapabilities
Businessmodel
Feasibility/Business component
requirements
Source: (Iyer et al 2003)
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Service-Oriented Architecture
ServiceRegistry
ServiceProvider
ServiceRequestor
Find Publish
Bind (HTTP)
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Web Services Architecture
ServiceRegistry
ServiceProvider
ServiceRequestor
FindPublish
Bind (to protocol)
UDDI
SOAP / XML
WSDL
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Points to consider
Are web services really tied to the web? Some are, some are not
First time everybody has agreed to a common standard
How are web services different from remote procedure calls?
How are web services different from EDI They expose business logic to your partners
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Remote Procedure Call (RPC)
What Client calls procedure contained in server
How Stub procedure in client marshals parameters
into a message Message sent to server Skeleton procedure on server
converts message back to parameters calls procedure sends return message
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Other RPCs – A history
DCE – Distributed computing environment
DCOM – MS distributed component object model
CORBA – Common object request broker architecture: language and platform independence
Java RMI – Remote method invocation Java VM gives platform independence
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Web Services are Much More
They are very flexible, hence not well defined
They may be applications communicating with messages
They may be a fancy RPC architecture
They may be something we have not discovered yet
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Grid and Web Services
Does anybody know what the grid is? A distributed computing enviroment.
Sounds like a web service! A grid service might be a bandwidth
intensive super computer type problem Or may not.
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
What’s Wrong With the Picture?
Vendors, and pundits agree, but remember they are never right! Remember OSI, X.400 email, and ATM
The overhead may be very high (100X) There are some research ideas to help
this Too much hype
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Key technologies
XML describe the information to be exchanged
SOAP package the information and move it between
client and service WSDL
Describe a service UDDI
Provide a list of available services
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
XML – Describes Complex Data
XML can describe documents & data Document v. Data -- What is the difference? For web services our primary interest is in data
XML is used to describe both data structure, and data
Data structure: what each bit is supposed to mean
XML describes complex, hierarchical data structures
In a form that is easily processed by a computer
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
SOAP – Simple Object Access Protocol
Very flexible message architecture SOAP is defined using XML SOAP provides an envelope Two styles of SOAP messages
RPC – remote calling XML data message – send/receive
arbitrary XML data SOAP can be used over HTTP, SMTP,
FTP
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
SOAP RPC
Encode the RPC call into a SOAP envelope with XML data
RPCs rely on special-purpose APIs RPCs are vulnerable to small
changes in API or data structure Limited “separation of concerns”
between client and service Tightly coupled!
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
SOAP RPC Trade-offs
Advantages Well understood Automatically
encodes/decodes application data
Easy to synchronize
Disadvantages Not very flexible Server must be
running for call to succeed
Only one-to-one interaction
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
SOAP Messaging
Send XML data from one application to another – loose coupling!
More flexible than RPC Queued Vs Direct
Sender Recipient
Sender Queue Recipient
Direct
Queued
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
SOAP Messaging Trade-offs
Advantages Simple API Any data can be
passed Separates data
from code Allows
disconnected operation (if queued)
Disadvantages Application must
encode and decode data
Queued systems are asynchronous, which may be hard to program
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
WSDL – Describing Web-Services
How does the client know how to access the web-service?
What are the parameters, and their data types?
What is returned by the service?
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
UDDI – Register Web-Services
Helps find the service Just a list of services Will this be by people, or programs? Useful to look at many different
services to decide which one you want
You, too, can browse UDDI registries
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Overview
XML SOAP WSDL UDDI
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
HTML Review
HyperText Markup Language
Mark up text with “tags” to identify formatting and linksHere is some <a /href=“yahoo.com”>text</a> with a tag in the middle.
Here are the tags you can use
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Examples
Emphasize some text <em>4 days</em> of classes to go!
A heading <h1>Ozzie’s Weblog</h1>
A hypertext link <a href=“http://www.bu.edu”>BU</a>
A list <ul><li>milk</li> <li>soup</li> </ul>
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
HTML Limitations
Inflexible Focus on formatting not content No semantics Presentation not data
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Enter XML
XML (eXtensible Markup Language) is not a programming language!
XML is a standard (a set of rules, guidelines or conventions) for designing data format for structured document interchange on the Web.
XML is defined by The World Wide Web Consortium (W3C). Source: (W3C 2001)
http://www.w3.org/XML/1999/XML-in-10-points
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Why XML? HTML Limitations
Inflexible Focus on formatting not content No semantics Presentation not data
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
XML is for Structuring Data
Structured data examples: Spreadsheets Address books Financial transactions Technical drawings
XML makes it easy for a computer to: Read data Generate data Ensure that the data structure is unambiguous
Source: (W3C 2001) http://www.w3.org/XML/1999/XML-in-10-points
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
XML Looks a Bit Like HTML
Use of tags (words bracketed by '<' and '>') and attributes (of the form name="value")
Tags: Only delimit pieces of data Leave the interpretation of the data
completely to the application that reads it
Source: (W3C 2001) http://www.w3.org/XML/1999/XML-in-10-points
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
XML is New, but Not that New
Development of XML started in 1996
Has been a W3C Recommendation since February 1998.
Source: (W3C 2001) http://www.w3.org/XML/1999/XML-in-10-points
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
XML Applications v. Processors
XML Application A markup language derived using XML
XML Processor Software created to process XML
documents
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
“Hello World” XML Example
<?xml version="1.0" standalone="yes"?>
<conversation> <greeting>Hello, world!</greeting> <response>Stop the planet, I want to
get off!</response></conversation>
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Example Application #1: XHTML
XHTML is the successor to HTML
An application restricts XML syntax XHTML allows "<p>", but not "<r>"
An application adds semantics to XML syntax
XHTML says that "<p>" stands for "paragraph", not for "price"
Source: (W3C 2001) http://www.w3.org/XML/1999/XML-in-10-points
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
But there’s more!XML is Modular
XML allows you to define a new document format by combining and reusing other formats.
To eliminate name confusion when combining formats, XML provides a namespace mechanism.
Source: (W3C 2001) http://www.w3.org/XML/1999/XML-in-10-points
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
XML Namespace
Tags can be given a prefix to identify context
Example: does solution refer to chemical compound or mathematical answer? <chem:solution> <math:solution>
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
What is SOAP?
Simple Object Access Protocol XML-based protocol for exchange of
information in a distributed environment. Route information to remote process Deliver binary data using MIME
attachments Encapsulate RPC calls
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
SOAP Message
A header and a body contained in an envelope Header: directives for the SOAP processor Body: data to be delivered to remote
recipient Envelope: contains header & body
Envelope must be prefaced by protocol binding
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Simplified Example
For simplicity have omitted namespace, XML directives, and other niceties
<envelope><header>
</header><body>
</body></envelope>
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Protocol Binding
SOAP message is delivered by underlying protocol (typically HTTP)
Protocol binding consists of directives to underlying protocol as to how to deal with SOAP message
For HTTP includes SOAPAction (optional) Host = … Content-Type = text/xml; charset=… Content-Length = …
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Special Messages
SOAP-RPC Represents remote procedure call &
response
SOAP-Fault Reports errors encountered in SOAP
processing
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
SOAP-RPC
The procedure call is encoded in the SOAP body
The call takes the form<method>
<parameter>value</parameter>
</method>
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
SOAP-RPC (2)
The response uses similar format Datatype of parameters is defined
via a SOAP-Encoding Attribute Example:
<parameter xsi:type=“xsd:string”>
Other aspects of RPC defined via WSDL
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Challenge: Can you identify the SOAP elements here?
POST /StockQuote HTTP/1.1 Host: www.stockquoteserver.com Content-Type: text/xml Content-Length: nnnn SOAPAction: Some-Namespace-URI#GetLastTradePrice
<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>
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
This is the Response to the Previous Message
HTTP/1.1 200 OKContent-Type: text/xml; charset="utf-8“Content-Length: nnnn
<SOAP-ENV:Envelopexmlns: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>
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
What is WSDL?
Web Services Description Language XML format Defined by W3C
Describes the internal structure of a web service
Extensible No commitment to specific message
formats or network protocols
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Elements of WSDL
Message Used to communicate with the web
service portType
A group of operations offered by one endpoint of the web service
There can be more than one portType (endpoint) for a single web service
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Elements of WSDL (2)
Binding Maps a portType to a concrete protocol
and data format (e.g. SOAP) Service
Maps each binding to a port located at some endpoint on the network
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Message
<message name=“MessageID”>
<part type=“typeID” name=“partID”/>
</message>
Gives the data structure of each message (e.g. the parameters used in an RPC call)
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
portType
<portType name=“portTypeID”><operation name=“opID”>
<input message=“msgID”/><output message=msgID”/>
</operation>
</portType> The sequence of messages defines the
behavior of the operation msgID points to one of the messages
defined above
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Operation
A set of messages which accomplishes some function
Operation Behavior Sequence of Messages
Request-response Input then Output
Solicit-response Output then Input
Notification Output only
One-way Input only
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Binding
Protocol specific binding extensions HTTP, SOAP, and MIME are standard
Each portType is associated with a binding
Example: SOAP Specifies type (document or RPC) Specifies how messages are placed in
the header and body
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Service
<service name=“service name”>
<documentation>Brief description of the service</documentation>
<port name=“portID” binding=“bindingID”>
<soap:address location=“url”>
</port>
</service>
Each binding is mapped to a port
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Service (2)
Used to aggregate a set of related ports Relationship between ports within a service:
None of the ports communicate with each other. If a service has several ports that share a port type, but
employ different bindings or addresses, the ports are alternatives. Allows a WSDL document consumer to choose particular port(s)
to communicate with based on some criteria (e.g., distance). By examining its ports, we can determine a service's
port types. Allows a WSDL document consumer to determine if it wishes to
communicate to a particular service based whether or not it supports several port types.
Source: (Christensen et al 2001)http://www.w3.org/TR/2001/NOTE-wsdl-20010315
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
WSDL Design Issues
Decomposition of a service into ports Granularity of operations Structure of the service, messages,
data elements, and so on
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
What is UDDI?
Universal Description, Discovery and Integration
An industry initiative to enable businesses to quickly, easily, and dynamically find and transact with one another. (www.uddi.org)
A specification under the ausipices of OASIS
UDDI enables a business to Describe its business and its services Discover other businesses that offer desired
services Integrate with these other businesses.Source: (OASIS 2003)
http://www.uddi.org/faqs.html
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
The UDDI Business Registry (1)
Provides a place for a company to register its business and the services that it offers.
People or businesses that need a service can use this registry to find a business that provides the service.
Operated as a distributed service. Currently, IBM and Microsoft operate registry nodes.
Access to and from the UDDI Business Registry is performed using SOAP.
However, a service registered in the UDDI Business Registry can expose any type of service interface.
Source: (OASIS 2003)http://www.uddi.org/faqs.html
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
The UDDI Business Registry (2)
Records the following information: Business Entity
A business entity represents information about a business (name, contact information, description, and a URL pointing to more information about the business).
Business Service Associated with the business entity is a list of business
services offered by the business entity. Specification Pointers
Associated with each business service entry is a list of binding templates that point to specifications and other technical information about the service.
Service Types
Source: (OASIS 2003)http://www.uddi.org/faqs.html
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
What is UDDI NOT?
The UDDI Business Registry: Not a general-purpose search engine
A search engine uses free-text queries to search unstructured data.
The UDDI Business Registry has very structured data. A query against the UDDI registry can only retrieve data stored
within the registry. Traditional search engines could use the UDDI Business
Registry as a source when compiling their responses and results.
UDDI project is not "run" by any one company. Currently guided by industry leaders spearheading
the early creation and design efforts
Source: (OASIS 2003)http://www.uddi.org/faqs.html
Aug 4, 2003
© Mark Gaynor, George Wyner, Bala Iyer, and Jim
Freedman 2003 AMCIS 2003
.NET and J2EE
Building Web Services
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Web Service Development Environment
Microsoft believes that you should be able to use any language to write a web service – They are right! As long as you use a Microsoft Platform
Sun believes that you should be able to use any platform you want – They are right! As long as you use the Java
programming language
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
What is Microsoft® .NET?
•Microsoft software technologies•Connecting information, people, systems, and devices
•Helps developers create XML Web services and stitch them together•Benefit to individuals:
•Seamless, compelling experiences with information sharing
•.NET connected software•Uses a distributed computing model•Builds on open standards like XML to connect PCs and other smart devices
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
.NET basics
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
.NET Framework
•The .NET framework has two components:•The common language runtime
•Agent that manages code at execution time, providing core services such as memory management, thread management, remoting, etc…
•.NET framework class library•Object-oriented collection of reusable types that can be used to develop applications ranging from traditional command-line or graphical user interface (GUI) applications to applications based on the latest innovations provided by ASP.NET, such as Web Forms and XML Web services.
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
What is ASP.NET?
•Hosting environment that enables developers to use the .NET Framework to target Web-based applications.•Architecture for developing Web sites and Internet-distributed objects using managed code.•XML Web services use ASP.NET as the publishing mechanism for applications.
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
What is J2EE?
•Java 2 Platform, Enterprise Edition•Component-based approach to the design, development, assembly, and deployment of enterprise applications•Not tied to the products or APIs of any one vendor•Freedom to choose products/components that best meet needs
•J2EE Offers:•Multitiered distributed application model•Ability to reuse components•XML-based data interchange•Unified security model•Flexible transaction control
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Distributed Multitiered Applications
•Application logic is divided into components according to function and the various application components that make up a J2EE application are installed on different machines depending on the tier in the multitiered J2EE environment to which the application component belongs. •The J2EE specification defines the following components:
Application clients and applets: run on the client.
Java Servlet and JavaServer Pages (JSP) technologyWeb components that run on the server
Enterprise JavaBeans (EJB) components (enterprise beans)business components that run on the server
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Multitiered Applications
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Web services implications
Enterprise integration Cross-enterprise business processes Nice way to access legacy
applications with Internet technology Is web-services the answer, no
matter what the question?
Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
References These slides are based on a lecture given by two of
the authors as part of a new course, Issues in Managing Networked Systems, taught at the BU School of Management.
Material drawn from online sources is cited with URL on individual slides.
Additional references Sleeper, B. "Defining Web Services," San Francisco: The
Stencil Group, 2001. Iyer, B., Freedman, J., Gaynor, M., and Wyner, G. "Web
Services: Enabling Dynamic Business Networks," Communications of the AIS (11), 2003.