[Title of presentation]

Download Report

Transcript [Title of presentation]

Introduction to Web Services
Geoff Williams
British Oceanographic Data Centre
Joseph Proudman Building
6 Brownlow Street
Liverpool L3 5DA, UK
Prerequisite knowledge
Client-server computing
• Server provides a service (i.e., www, email, etc.)
• Client uses the service
• A client can use many services
• A server can provide a service to many clients
• A single computer may fulfil more than one role
Client
(user)
Database
Client
WWW server
WWW Server
WWW Client
Database
Server
WWW server
What is a Web service?
W3C Definition
• “A software system designed to support interoperable
machine-to-machine interaction over a network. It has an
interface described in a machine-processable format
(specifically WSDL). Other systems interact with the Web
service in a manner prescribed by its description using SOAP
messages, typically conveyed using HTTP with XML
serialization in conjunction with other Web-related
standards.”
(W3C, 2004)
What is a Web service?
Another definition
• “Web services are a distributed computing architecture. Only
this particular architecture makes use of loosely coupled
applications, as opposed to tightly coupled applications, to
enable applications to communicate. This tightly coupled
concept radically affects how information systems will work in
the future”
(Clabby 2003)
My own observations
• Web services provide a convenient and standardised way of
exposing business logic over a network (the Internet)
• Convenient: WS frameworks (i.e., AXIS) do the hard work
for us
• Standardised: SOAP (XML) provides a language to speak
to clients
• BODC expose controlled vocabularies via Web services
• The interface to this business logic (data in/data
out/operations) is formally documented in the service WSDL
• Client code is normally generated automatically from the
WSDL, so programmers do not need to worry about writing it
• Programs that use Web services work by sending a request
to a Web service and using the result somehow, i.e.,
displaying it or using it to perform a calculation
Real-world Web services
The Web service encapsulates and controls access to the
Controlled vocabularies. This design is known as a “wrapper”
Internet
Program
Users
Note: The user is not
directly using the Web
service.
BODC Controlled
Vocabularies
Web service
What are Web services aren’t
• Not a human-readable web page
• Not necessarily available over the Internet
• Not a fundamentally new business concept
• Not independent of web applications
• Not solely externally focussed
• Not a way of making your application more robust, secure
and available
• Not a user-centric self-contained application
(Claßen 2002)
How do I use a Web service?
1. Find the web service you want to use
2. Tell the application you are writing where to get the service
WSDL
3. Generate the client code (often done automatically)
4. Your application sends a request to the service
5. Your application receives and processes the result
This is best explained with a diagram…
How do I use a Web service
UDDI(?)
Uses
Writes
Code
Generate WS client
&
Compile/Execute
Choose Web service
Internet
Uses
WSDL
SOAP messages
Program
Web service
How can Web services benefit my
organisation?
• Developers can focus on writing applications instead of
worrying about infrastructure
• Reduced application development time and expense
• A portfolio of Web services may be built
• New collaboration opportunities
• Repackage existing products to better reach/serve user base
(Clabby 2003)
Key technologies
XML (eXtensible Markup Language)
• A language for describing new languages (metalanguage)
• Platform independent
• Defined with Unicode allowing representation of many
languages
• XML concepts
•
•
•
•
•
•
Elements
Attributes
Comments
Literal text
Document
DTD/Schema
(Weerawarana et al 2005)
Key technologies
UDDI (Universal Description, Discovery and Integration)
• An XML dialect
• Provides a single well-known place to search for services
(Weerawarana et al 2005)
• A “registry standard” that allows applications to describe
themselves to other applications (Clabby 2003)
• Ability to dynamically select a service at runtime
• Public registries don’t provide the level of trust that is
required to allow a service requestor to select and use any
service provider listed in the registry (Graham 2005)
• Most interest in UDDI focuses on private registries hosted on
the Internet or an intranet, usually for a specific purpose
(Graham 2005)
Key technologies
WSDL (Web Services Description Language)
• An XML dialect
•
Describes how to communicate with a Web service
•
What a service does
•
• Operations
• Data (in and out)
How service accessed
•
• Data formats
• Protocols
Where located
• Network address (URL)
• The location is known as a “service endpoint”
(Graham et al. 2005)
Key technologies
SOAP (Simple Object Access Protocol)
• An XML dialect
• Messaging framework providing resilience, scalability and
flexibility
• Standardized message structure based on XML
• Processing model describing how to process messages
• Mechanism to bind SOAP messages to different network
protocols
• Attach non-XML encoded information to SOAP requests
(Weerawarana 2005)
• All data needs to be converted into SOAP format prior to
transmission. This is known as serialisation.
• All data received in SOAP format needs to be converted
back to its original form. This is known as deserialisation.
Key technologies
HTTP (Hyper Text Transfer Protocol)
• Protocol for transferring data across the Internet
• Main use is for delivering web pages and associated content
• Web services generally use HTTP to transfer data
• Ubiquitous support
• Passes through corporate firewalls unchallenged
(usually)
Key technologies
Web services framework
• Provides an easy and reusable way to use WSDLs, SOAP
and UDDI
• Programmer only needs to learn how to program to the
frameworks’ interface and does not need to worry about
manually building SOAP messages, etc.
• Popular frameworks:
•
•
•
•
•
•
•
•
Axis (Java) http://ws.apache.org/axis/
Axis2 (Java) http://ws.apache.org/axis2/
SOAP module (PHP4) http://pear.php.net/package/SOAP
SOAP extensions (PHP5) compile time option
SOAP::Lite (Perl) http://www.soaplite.com/
SOAPy (Python) http://soapy.sourceforge.net/
C#/VB/ (Windows) Support via visual studio
…And many more!
UDDI – Pinch of salt required
• Most text books present UDDI as a the web service
equivalent to an Internet search engine where business
services can be selected automatically, however:
• Computer programs autonomously selecting
strategic business partners is not desirable
• Far from being a panacea, public UDDI directory
support is immature and may never mature
• A UDDI directory may disappear altogether
(BindingPoint), potentially breaking your application
• However, a specialist UDDI registry may be of interest to
the oceanographic community
How it all fits together
Data
Application software
Web services framework
UDDI(?)
WSDL
XML
Client
SOAP
HTTP
Network stack (TCP/IP)
Media
Internet
Network stack (TCP/IP)
HTTP
SOAP
UDDI(?)
WSDL
Web services framework
Data
Application software
Server
XML
•Each layer ‘wraps’
the functionality of
the previous one
adding features and
improving reliability
•The client software
stack is the mirror
image of the server’s
stack (generally)
•UDDI is optional
but included for
completeness
•The client doesn’t
generate a WSDL, it
just obtains one
from the server
Thanks for listening
Any questions?
References
• Booth, D. et al. (2004) Web Services Architecture
[Internet], February. Available from:
<http://www.w3.org/TR/ws-arch/> [Accessed 5 February
2007].
• Claßen, M. (2002) What Web Services Are Not [Internet],
Jupitermedia Corp. Available from:
<http://www.webreference.com/xml/column50/> [Accessed 5
February 2007]
• Clabby, J. (2003) Web Services Explained. New Jersey
USA, Prentice Hall PTR.
• Weerawarana, S. et al (2005) Web Services Platform
Architecture: SOAP, WSDL, WS-POLICY WS-Addressing,
WS-BPEL, WS-Reliable Messaging, and More. New
Jersey USA, Prentice Hall PTR.
• Graham, S. et al (2005) Building Web Services With Java:
Making Sense Of XML, SOAP, WSDL, AND UDDI