Transcript IS705 Class 1: Introduction to Web Services
Aug 4, 2003
Tutorial
Introduction to Web Services By Mark Gaynor Boston University School of Management
© Mark Gaynor, George Wyner, Bala Iyer, and Jim Freedman 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” Aug 4, 2003 Bala, course,F02 BU Student Hay Bala, what course are you teaching?
© Mark Gaynor, et al. 2003 BU Student Prof.
Bala Now I am teaching a course about using information …..
Prof.
IS323 Bala 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 SOAP message
XML:
Temp for: Cambridge MA Weather-service SOAP message
XML:
Temp is: 91.5F
Client Aug 4, 2003 © Mark Gaynor, et al. 2003 Web services Yellow Pages Weather-service Directions for use Time-service Traffic-service AMCIS 2003
Example
Online shopping application Credit card verification & Authentication of user: Client Aug 4, 2003 WAN
SOAP
Credit card verification & Authentication of users web service Credit card verification: Client
SOAP
WAN Credit card verification web service Authentication of user: Client
SOAP
Authentication of users web service Web Server © Mark Gaynor, et al. 2003 Web
(soap)
Services Server 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 Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Owner Business model
Stakeholder Views of Web Services
Architect Component requirements Builder design principles,component requirements) End-user Requests Web Service Capabilities Web Service Architectures Web Service Products Web Service Applications Feasibility/ Business component requirements Design principles, Component requirements & interfaces Source: (Iyer et al 2003) Application Build-out & integration Results
Service-Oriented Architecture
Service Registry Find Publish Aug 4, 2003 Service Requestor Bind (HTTP) © Mark Gaynor, et al. 2003 Service Provider AMCIS 2003
Web Services Architecture
Service Registry Find Publish Aug 4, 2003 Service Requestor SOAP / XML Bind (to protocol) © Mark Gaynor, et al. 2003 Service Provider 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 Aug 4, 2003
Direct
Recipient Sender © Mark Gaynor, et al. 2003 Queue
Queued
Recipient 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 links Here is some
text
a tag in the middle.
Here are the tags you can use with Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003
Examples
Emphasize some text 4 days of classes to go!
A heading
Ozzie’s Weblog
A hypertext link BU A list
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 programming language!
not a 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
Example Application #1: XHTML
XHTML is the successor to HTML An application restricts XML syntax XHTML allows "
", but not " " 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 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 Tags can be given a prefix to identify context Example: does solution refer to chemical compound or mathematical answer? 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 A and a contained in an 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 For simplicity have omitted namespace, XML directives, and other niceties Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003 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 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 The procedure call is encoded in the SOAP body The call takes the form The response uses similar format Datatype of parameters is defined via a SOAP-Encoding Attribute Example: 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 Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003 This is the Response to the Previous Message HTTP/1.1 200 OK Content-Type: text/xml; charset="utf-8“ Content-Length: nnnn Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003 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 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 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 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
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 A set of messages which accomplishes some function Operation Behavior Sequence of Messages Request-response Input then Output Solicit-response Output then Input Notification One-way Output only Input only Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003 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
Each binding is mapped to a port Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003 Source: (Christensen et al 2001) http://www.w3.org/TR/2001/NOTE-wsdl-20010315 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. Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003 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 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 Source: (OASIS 2003) http://www.uddi.org/faqs.html 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. Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003 Source: (OASIS 2003) http://www.uddi.org/faqs.html 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 Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003 Source: (OASIS 2003) http://www.uddi.org/faqs.html 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 Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003 Building Web Services Aug 4, 2003 © Mark Gaynor, George Wyner, Bala Iyer, and Jim Freedman 2003 AMCIS 2003 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 •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 Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003 •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 • 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 •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 •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) technology Web 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 Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003 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 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. Aug 4, 2003 © Mark Gaynor, et al. 2003 AMCIS 2003But there’s more!
XML is Modular
XML Namespace
What is SOAP?
SOAP Message
header envelope
body
Simplified Example
Protocol Binding
Special Messages
SOAP-RPC
SOAP-RPC (2)
What is WSDL?
Elements of WSDL
Elements of WSDL (2)
Message
portType
Operation
Binding
Service
Service (2)
WSDL Design Issues
What is UDDI?
The UDDI Business Registry (1)
The UDDI Business Registry (2)
What is UDDI NOT?
.NET and J2EE
Web Service Development Environment
What is Microsoft® .NET?
.NET basics
.NET Framework
What is ASP.NET?
What is J2EE?
Distributed Multitiered Applications
Multitiered Applications
Web services implications
References