introduction to web services - coekrunapon/courses/178375/slides/intro2ws.pdf · introduction to...
TRANSCRIPT
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 1
1
Introduction to Web Services
Dr. Kanda Runapongsa
Dept. of Computer Engineering
Khon Kaen University
2
Agenda
�Web Technologies
�What is a Web Service?
�Why Web Services?
�Where are Web Services?
�Web Services Architecture and Standards
�Web Services Development
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 2
3
Web Applications (1/2)
�Application delivered to users from a web
server over a network such as the World
Wide Web or an intranet
�Users usually access Web application via
the Web browser
�Human interaction with programs
�HTML forms
�Web programming
4
Web Applications (2/2)
HTMLHTMLHTMLHTML
Client Side
• JavaScript• VBScript
Server SideServer SideServer SideServer Side
•ASP•PHP•JSP
Static Web
Dynamic Web
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 3
5
Traditional Web Interaction
HTMLHTMLHTMLHTMLWebWebWebWeb
ApplicationApplicationApplicationApplication
WebWebWebWeb
UserUserUserUser
6
Web Services Interaction
ApplicationApplicationApplicationApplication
Web ServiceWeb ServiceWeb ServiceWeb Service
XMLXMLXMLXML
WebWebWebWeb
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 4
7
Web Application vs. Web Services
�Web Application
� HTML
� User-to-program interaction
� Static integration of components
�Monolithic service
�Web Services
� XML
� Program-to-program interaction
� Dynamic integration of components
� Service aggregation
8
Distributed Computing Technologies
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 5
9
Waves of Innovation
10
Internet Evolution
Browse the Web
Programthe Internet
Technology
Standard
Web services
XML
Programmability
HTML
Web pages
PresentationFTP, e-mail, Gopher
TCP/IP
Connectivity
Innovation
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 6
11
Agenda
�Web Technologies
�What is a Web Service?What is a Web Service?What is a Web Service?What is a Web Service?
�Why Web Services?
�Where are Web Services?
�Web Services Architecture and Standards
�Web Services Development
12
What is a Web Service?
�A Web service is a software systemsoftware systemsoftware systemsoftware system identified
by a URI,
�Whose public interfaces and binds are
defined and described using XMLdefined and described using XMLdefined and described using XMLdefined and described using XML
� Its definition can be discovered by other
software systems
�These systems may then interact with the
Web service in a manner prescribed by its
definition, using XML based messagesXML based messagesXML based messagesXML based messages
conveyed by Internet protocolsInternet protocolsInternet protocolsInternet protocols
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 7
13
Where do Web Services Come From?
�Two words: Web services
WWW SOA
Web servicesarchitecture
SOA =Service-orientedArchitecture
14
Service-Oriented Architecture
Service BrokerService BrokerService BrokerService Broker
Service ConsumerService ConsumerService ConsumerService Consumer Service ProviderService ProviderService ProviderService Provider
ClientClientClientClient ServiceServiceServiceService
Service broker is Service broker is Service broker is Service broker is
OptionalOptionalOptionalOptional
interact
ServiceServiceServiceService
ContractContractContractContract
…………
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 8
15
Characteristics of Web Services�XML based everywhere
�Message-based
�Programming language independent
�Could be dynamically located
�Could be dynamically assembled or aggregated
�Accessed over the internet
� Loosely coupled
�Based on industry standards
16
Sample Web Service
User
Stock Quote Web ServiceInput: Symbol
Output: Price, News, Trade
SetTradeInput: SymbolOutput: Price
News feed 1Input: Symbol
Output: News links
…
News feed nInput: Symbol
Output: News links
Brokerage 1Input: Symbol, Price, Qty
Output: Analysis
Brokerage nInput: Symbol, Price, Qty
Output: Analysis
..
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 9
17
Sample Web Services Usage Scenario
�E-commerce: order books, office supplies,
other products
�Track packages: UPS, FedEx
�Weather forecast
�Search location on Maps
�Telephone redirection, customizable rules
and messages
18
Agenda
�Web Technologies
�What is a Web Service?
�Why Web Services?Why Web Services?Why Web Services?Why Web Services?
�Where are Web Services?
�Web Service Architecture and Standards
�Web Service Development
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 10
19
� New user experience� Software for smart device� Connected Web services
XM
LXML
XM
L XML
XM
L
Enabled through XML
?
?
??
Web Services Enabled through XML
20
Why Web Services? (1/3)
�Platform neutral
�Accessible in a standard way
�Accessible in an interoperable way
�Use simple and ubiquitous tools
�Relatively cheap
�Simplify enterprise integration
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 11
21
Why Web Services? (2/3)
� Interoperable – Connect across
heterogeneous networks using ubiquitous
web-based standards
�Economical – Recycle components, no
installation and tight integration of software
�Automatic – No human intervention required even for highly complex
transactions
22
Why Web Services? (3/3)
�Accessible – Legacy assets & internal
applications are exposed and accessible on the Web
�Available – Services on any device, anywhere, and anytime
�Scalable – No limits on scope of applications and amount of heterogeneous applications
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 12
23
Impact of Web Services
24
Myths about Web Services (1/2)
�Web Services are something completely new
�Web services is distributed computing all over again – only now it is based on the web
�Web services are XML-based
�You have to write Web Services from scratch
� Tools available for developing Web services, such as MS .NET, Apache Axis, J2EE, and Systinet
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 13
25
�Web services require only SOAP, WSDL,
and UDDI
�We need more high-level semantics
�Web services are based on the RPC
paradigm
� Document-driven model would be more
popular communication model
�Web services must be based on HTTP
� Other transports such as SMTP can also be
used
Myths about Web Services (2/2)
26
Agenda
�Web Technologies
�What is a Web Service?
�Why Web Services?
�Where are Web Services?
�Web Services Architecture and Standards
�Web Services Development
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 14
27
Amazon.com Web Service
� URL http://www.amazon.com/webservices
�What users can do
�Search for products and information about products, such as product comments
� Statistics
�More than 50,000 developers have registered to
request the ID for AWS
�Over 900,000 Web sites have joined Amazon.com
Associates
� Reference applications� Amazon Course Item for Blackboard 6
� OK Mall
28
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 15
29
eBay Developers Program� URL http://developer.ebay.com/DevProgram/
�What users can do�Send a list of products to be sold
�View a list of products currently being sold
� Statistics (As of December 2005)�About 25,000 members who use eBay API
�About 1,900 applications call eBay API
�About 47% of eBay.com listings are thourgh eBay Web Services
�During Q4 2005, the eBay Platform handled more than 8 billion Web services requests, up from less than 1 billion for the entire year of 2002.
�The number of eBay Web Services transactions through APIs increased 84% annually
30
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 16
31
Yahoo Developer Network
�URL http://developer.yahoo.com�What developers can do
� Use Yahoo! Maps APIs to point to or embed Yahoo! Mpas on their site to display locations and overlay data dynamically
� Use Flickr API to start building a photo sharing application
� Use Yahoo! Search APIs
� Use Yahoo! Widgets which are minature client applications that run within the Yahoo! Widget Engine
32
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 17
33
Google Web APIs
�URL http://www.google.com/apis/
� Software developers can query billions of web pages directly from their own computer programs
� Google uses the SOAP and WSDL standards so a developer can program in his or her favorite environment - such as Java, Perl, or Visual Studio .NET
� To use Google Web APIs, users must
�Download the developer's kit
�Create a Google Web account
�Write a program using user’s license key
34
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 18
35
Thailand: E-Revenue Web Services
�URL http://www.rd.go.th/webservice/
�Create service oriented organization by
providing professional services to
citizens to improve efficiency and
fairness in taxcollection
�Serve as a catalyst in driving e-services / e-commerce take up via business
partnership
�Sample services: PIN/TIN Verification
Info, VAT Refund for Tourist info
36
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 19
37
Thailand: PTT Internet Web Services
�URL http://www.pttplc.com/pttinfo.asmx
�The users can get the information about oil price and news related to oil
�Support these five operations�GetOilPrice
�CurrentOilPrice
�GetNews
�CurrentNews
�CurrentOilPriceDS
38
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 20
39
Search for Available Web Services�Web Services List and
� http://www.wsiam.com
� List of Web Services
� http://www.xmethods.com
�Web services diagnostics and testing
� http://www.mindreef.net
�Resources and services for SOAP
� http://www.soapclient.com/
� Free Web Services – Web Services List
� http://www.webservicex.net/WS/wscatlist.aspx
40
Web Services Resources in Thailand
�Web Services Forum at KKU
� http://campus.en.kku.ac.th/campusboard
� Tutorials in Thai
� http://www.wsiam.com
�XML and Web Services Course at KKU� http://gear.kku.ac.th/~krunapon/178375
�Web Services Contest in National Software Const organized by NECTEC� http://www.hpcc.nectec.or.th/wiki/index.php/Web_Services_Contest
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 21
41
Agenda
�Web Technologies
�What is a Web Service?
�Why Web Services?
�Where are Web Services?
�Web Services Architecture and
Standards
�Web Services Development
42
Web Services Architecture
1. Service Registers(Publish)
2. Client requestservice location
(Discover)
3. Client calls service(Bind)
UDDI Registry
Service Provider Service Client
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 22
43
Operation Models for Web Services (1/3)
�Web Service Provider
�Creates the Web service typically as
SOAP-based service interfaces
�Deploys the service and makes them
available for invocation over a network
�Describes the Web service as a WSDL-based service description
�Registers the WSDL-based service
description with a service broker, which
is typically a UDDI registry
44
Operation Models for Web Services (2/3)
�Registry
�Stores the service description as binding
templates and URLs to WSDLs located
in the service provider environment
�List various service types, descriptions,
and locations of the services that help
the service requesters find and
subscribe to the required services
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 23
45
Operation Models for Web Services (3/3)
�Service Clients� Locates the required services by querying the UDDI registry
� Obtains the binding information and the URLs to identify the service provider
� Invokes the service provider
� Retrieves the WSDL Service description for those registered services
� Communicate with the service provider
� Exchange data or message by invoking the available services in the service container
46
Web Services Interaction Diagram
Request WSDL location
UDDI
Registry1
Download WSDL WSDL
2
3
Web
Services
Send SOAP messages
with XML documents
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 24
47
Web Services Standards
�XML (Extensible Markup Language)
�SOAP (Simple Object Access Protocol)
�WSDL (Web Services Description
Language)
�UDDI (Universal Description and
Discovery Integration)
48
Extensible Markup Language
�Text-based Markup Language
�Markup is the extra information for describing and formatting data
�Standard language for exchanging and representing data on the Internet
�Both XML and HTML are markup languages�<b>NSC</b>
�<event>NSC</event>
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 25
49
HTML vs. XML
�Language Purposes
�HTML tags are designed for indicating the format (Web browser)
Example: <b>NSC</b>
�XML tags are designed for describing data
Example: <event>NSC</event>
50
Sample XML Document
<?xml version=“1.0”?>
<nation>
<name>Thailand</name>
<location>Southeast Asia</location>
</nation>
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 26
51
Desirable Features of XML (1/2)
�Simple and extensible
� License-free
�Platform independent
� International language support
�Read and edit XML using any standard
text-editing tool
�Several applications and usage
52
Desirable Features of XML (2/2)
�Easy data exchange
�Customizing Markup Languages
� ebXML (Electronic Business Markup Language)
�Self-describing
�Make automation of data processing possible
�Validation
� Apply semantic rules to specify the structure of document for validation
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 27
53
XML Applications
�System independent and vendor
independent
�Has metadata markup and is deliverable
via the Web
�There are style sheets for views and
transforms information
�XML enables integration of legacy
systems and new systems
54
Web Services Standards
�XML (Extensible Markup Language)
�SOAP (Simple Object Access Protocol)SOAP (Simple Object Access Protocol)SOAP (Simple Object Access Protocol)SOAP (Simple Object Access Protocol)
�WSDL (Web Services Description
Language)
�UDDI (Universal Description and
Discovery Integration)
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 28
55
What is SOAP?�SOAP stands for Simple Object Access Protocol
�SOAP is a lightweight protocol intended for exchanging structured information exchanging structured information exchanging structured information exchanging structured information
�SOAP uses XML technologies to define an extensible messaging frameworkextensible messaging frameworkextensible messaging frameworkextensible messaging framework
�The framework has been designed to be independent of any particular independent of any particular independent of any particular independent of any particular programming modelprogramming modelprogramming modelprogramming model and other implementation specific semantics
56
What SOAP is Not
�Not a component model
� It will not replace objects and
components, i.e., EJB, JavaBeans
�Not a programming language
� It will not replace Java
�Not a solution for all
� It will not replace other distributed
computing technologies such as RMI
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 29
57
SOAP Message Format
SOAP Message
…
Primary MIME part(text/xml)
Attachment
Attachment
Attachment
SOAP Envelope
SOAP Header
SOAP Body
Header Entry
Header Entry
…
Body Entry
Body Entry
…
58
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/
soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:add<ns1:add<ns1:add<ns1:add soapenv:encodingStyle=
"http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://localhost:8090/axis/Calcu
lator/Calculator.jws">
<ns1:arg0 xsi:type="xsd:int">2</ns1:arg0><ns1:arg0 xsi:type="xsd:int">2</ns1:arg0><ns1:arg0 xsi:type="xsd:int">2</ns1:arg0><ns1:arg0 xsi:type="xsd:int">2</ns1:arg0>
<ns1:arg1 xsi:type="xsd:int">3</ns1:arg1><ns1:arg1 xsi:type="xsd:int">3</ns1:arg1><ns1:arg1 xsi:type="xsd:int">3</ns1:arg1><ns1:arg1 xsi:type="xsd:int">3</ns1:arg1>
</ns1:add>
</soapenv:Body>
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 30
59
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/
soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:addResponse soapenv:encodingStyle="http://schemas.xml
soap.org/soap/encoding/" xmlns:ns1="http://localhost:8090/ax
is/Calculator/Calculator.jws">
<ns1:addReturn xsi:type="xsd:int">5</ns1:addReturn><ns1:addReturn xsi:type="xsd:int">5</ns1:addReturn><ns1:addReturn xsi:type="xsd:int">5</ns1:addReturn><ns1:addReturn xsi:type="xsd:int">5</ns1:addReturn>
</ns1:addResponse></soapenv:Body>
</soapenv:Envelope>
60
Web Services Standards
�XML (Extensible Markup Language)
�SOAP (Simple Object Access Protocol)
�WSDL (Web Services Description WSDL (Web Services Description WSDL (Web Services Description WSDL (Web Services Description
Language)Language)Language)Language)
�UDDI (Universal Description and
Discovery Integration)
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 31
61
What is WSDL?
�WSDL stands for Web Services Description
Language
�XML language for describing web servicesXML language for describing web servicesXML language for describing web servicesXML language for describing web services
�XML service is described as
� A set of communication endpoints (ports)
�Endpoint is made of two parts
� Abstract definition of operations and messages
� Concrete binding to networking protocol and message format
62
Why WSDL?
�Enable automation of communication
details between communicating partners
�Machines can read WSDL
�Machines can invoke a service defined in WSDL
�Discoverable through registry
�Arbitration
� 3rd party can verify if communication conforms to WSDL
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 32
63
64
Web Services Standards
�XML (Extensible Markup Language)
�SOAP (Simple Object Access Protocol)
�WSDL (Web Services Description
Language)
�UDDI (Universal Description and UDDI (Universal Description and UDDI (Universal Description and UDDI (Universal Description and
Discovery Integration)Discovery Integration)Discovery Integration)Discovery Integration)
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 33
65
What is UDDI?
�UDDI stands for Universal Description, Discovery and Integration
�Programmatic registration and discovery of business entities and their Web services
�Based on SOAP, HTML, and XML
�Registry data� Business registrations
� Service type definitions
66
Available UDDI
�UDDI Browser
http://soapclient.com/uddisearch.html
� IBM UDDI Business Registry
https://uddi.ibm.com
�Microsoft UDDI
http://uddi.microsoft.com
�SAP UDDI
http://uddi.sap.com
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 34
67
Open Source Web Services Development
Tools
�Apache Axis
� http://ws.apache.org/axis
�PHP NuSOAP
� http://dietrich.ganx4.com/nusoap/index.php
�SUN J2EE: Java Technology and Web
Services
� http://java.sun.com/webservices/index.jsp
68
Commercial Web Services Development Tools
� BEA WebLogic Web Service� http://dev2dev.bea.com//webservices
� Cape Clear � http://www.capeclear.com/
� IBM WebShpere Software� http://www-306.ibm.com/software/websphere/
� MS .NET� http://msdn.microsoft.com/webservices/
� Systinet� http://www.systinet.com/
� webMethods� http://www.webmethods.com
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 35
69
Web Services Development Tools
70
Web Servers
�Microsoft IIS
�Sun Application Server
�Apache
�Jarkata Tomcat
�Oracle
�Systinet Web Server
�JBoss
�BEA Weblogic Server
Introduction to Web Services
Dr. Kanda Runapongsa, Dept. of Computer Engineering, KKU 36
71
Summary
�Web services technology exists for making different systems seamlessly work together
�XML is the language of exchange data
�Web service standards are open standards
�Web services have been developed and used extensively in many countries
� Thailand should develop and employ Web
services technology more for the benefits of
more effective management and business profits
72
References� Web Services ABC
http://www.wsiam.com/document/abcwebservices/webservicesabc.jsp
� http://ws.cmsthailand.com/
� Amazon and eBay Web services usage statistics
http://www.itfacts.biz/index.php?id=P1340
� eBay Web Services Usage Statistics
http://blogs.zdnet.com/ITFacts/?p=10326� ����������� ���������������� ����� (���� )
http://www.ais.co.th/thai/news02.html
� Hugo Haas, W3C, “Designing the architecture for Web Services”, http://www.w3.org/2003/Talks/0521-hh-wsa/
� http://www.javapassion.com/webservices/
� http://www.microsoft.com/thailand