WEB SERVICES Introduction
description
Transcript of WEB SERVICES Introduction
![Page 1: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/1.jpg)
Grid Computing, B. Wilkinson, 2004 3a.1
WEB SERVICES
Introduction
![Page 2: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/2.jpg)
Grid Computing, B. Wilkinson, 2004 3a.2
Web Services
• Software components designed to provide specific operations (“services”) accessible using standard Internet technology.
• For machine interaction over a network.
• Usually through SOAP (simple Object Access Protocol) messages carrying XML documents, and a HTTP transport protocol.
![Page 3: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/3.jpg)
Grid Computing, B. Wilkinson, 2004 3a.3
Basic client-server model
![Page 4: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/4.jpg)
Grid Computing, B. Wilkinson, 2004 3a.4
• Client needs to:– Identify location of the required service– Know how to communicate with the service
to get it to provide the actions required.
• Uses service registry - a third party.
![Page 5: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/5.jpg)
Grid Computing, B. Wilkinson, 2004 3a.5
Service-Oriented ArchitectureSteps:
• Services “published” in a Service registry.
• Service requestor asks Service Registry to locate service.
• Service requestor “binds” with service provider to invoke service.
![Page 6: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/6.jpg)
Grid Computing, B. Wilkinson, 2004 3a.6
2. Find
3. Bind
1. Publish
Service-Oriented Architecture
Service requester
Service registry
Service provider
![Page 7: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/7.jpg)
Grid Computing, B. Wilkinson, 2004 3a.7
Key aspects
Has similarities with RMI and other distributed object technologies (CORBA etc.) but::
• Web Services are platform independent– They use XML within a SOAP message).– Most use HTTP to transmit message.
![Page 8: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/8.jpg)
Grid Computing, B. Wilkinson, 2004 3a.8
XML-based Web Services
• XML provides a flexible basis for storing and retrieving service information on web services.
• Web services use data-centric XML documents to communicate information.
![Page 9: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/9.jpg)
Grid Computing, B. Wilkinson, 2004 3a.9
Web Services “Stack”
• HTTP transport
• SOAP message carrying XML documents
• WSDL (Web Services Description Language used to describe message syntax for invoking a service and its response.
• UDDI (Universal Description, Discovery and Integration) used as web service discovery mechanism.
![Page 10: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/10.jpg)
Grid Computing, B. Wilkinson, 2004 3a.10
Web Services “Stack”
+ XML
![Page 11: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/11.jpg)
Grid Computing, B. Wilkinson, 2004 3a.11
Web Services
From http://www.globus.org
1
23
45
6
![Page 12: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/12.jpg)
Grid Computing, B. Wilkinson, 2004 3a.12
Simple Object Access Protocol (SOAP)
A communication protocol for passing XML documents. Provides mechanisms for:
– Defining communication unit - a SOAP message– Error handling– Extensions– Data representation– Remote Procedure Calls (RPC’s)– Document-centric approach for business transactions– Binding to HTTP
![Page 13: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/13.jpg)
Grid Computing, B. Wilkinson, 2004 3a.13
SOAP Envelope<SOAP-ENV:Envelope
xmlns=“http://schemas.xmlsoap.org/soap/envelope/”>
<SOAP-ENV:header>.
.
.
</SOAP-ENV:Header>.
.
.
<SOAP-ENV:Body>.
.
.
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
namespace,see later
![Page 14: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/14.jpg)
Grid Computing, B. Wilkinson, 2004 3a.14
What goes down the Wire
HTTP packet containing:– Stuff about context, transactions, routing,
reliability, security– SOAP message– Attachments
XML/SOAP standardization body, World Wide Web Consortium (W3C) covers SOAP and attachments.
![Page 15: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/15.jpg)
Grid Computing, B. Wilkinson, 2004 3a.15
Structure of an XML document
• Optional Prolog
• Root Element
![Page 16: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/16.jpg)
Grid Computing, B. Wilkinson, 2004 3a.16
Prolog
• Includes processing instruction (<? … ?>) to specify how to process document..
• Includes meta-information about document, and comments.
![Page 17: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/17.jpg)
Grid Computing, B. Wilkinson, 2004 3a.17
• One PI identifies document as a XML document, e.g.
<?xml version=“1.0” encoding=“UTF-8”?>
• Comments, same form as HTML:
<!-- this is a comment -->
![Page 18: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/18.jpg)
Grid Computing, B. Wilkinson, 2004 3a.18
Root element
• Root element contains contents of document.
• Other elements are within root element and can be nested.
![Page 19: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/19.jpg)
Grid Computing, B. Wilkinson, 2004 3a.19
XML Tags
• Not predefined as in HTML.
• Must define your own tags using names as names in a programming languages
• As in programming languages, restrictions. Case sensitive. Start with a letter.
• “Elements” have start and end tags.
• Start tags can have attributes as in HTML.
![Page 20: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/20.jpg)
Grid Computing, B. Wilkinson, 2004 3a.20
Namespace Mechanism
• If XML documents combined, can be problem if different documents use the same tag names to mean different things.
• With namespace mechanism, tags given additional namespace identifier to qualify it.
![Page 21: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/21.jpg)
Grid Computing, B. Wilkinson, 2004 3a.21
Qualifying names
• Qualified name given by namespace identifier and name used in document:
Qualified name = namespace identifier + local name
![Page 22: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/22.jpg)
Grid Computing, B. Wilkinson, 2004 3a.22
Namespace identifier
• Uses URI’s (Uniform Resource Identifiers) - web naming mechanism.
• URLs are a subset of URI, and would typically be used, e.g.:
http://www.cs.wcu.edu/~abw/ns
![Page 23: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/23.jpg)
Grid Computing, B. Wilkinson, 2004 3a.23
URIs also include email addresses, i.e.
mailto:[email protected]
and
Uniform Resource Names (URNs) which are globally unique and persistent. UDDI uses URNs.
![Page 24: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/24.jpg)
Grid Computing, B. Wilkinson, 2004 3a.24
Associating namespace identifier with local name
• Names in document given a prefix, i.e.:<mypo:street>
• Namespace identifier associated with prefix in root element::
xmlns:po=“http://www.cs.wcu.edu/~abw/ns”
![Page 25: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/25.jpg)
Grid Computing, B. Wilkinson, 2004 3a.25
Namespace Example
<mypo:po xmlns:mypo=“http://www.cs.wcu.edu/~abw/ns”>
<mypo:description>
Computer, Pentium IV, 2.8 Ghz, 4 Gbytes main memory
</mypo:description>
</mypo:po>
prefix
![Page 26: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/26.jpg)
Grid Computing, B. Wilkinson, 2004 3a.26
Can apply namespace to every tag without a prefix automatically if that is required:
<mypo:po xmlns=“http://www.cs.wcu.edu/~abw/ns”>
<description>
Computer, Pentium IV, 2.8 Ghz, 4 Gbytes main memory
</description>
</mypo:po>
![Page 27: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/27.jpg)
Grid Computing, B. Wilkinson, 2004 3a.27
Defining Legal XML Tags
• Legal tags in a document defined optionally using either:
– Document type definitions (DTD) within document. <!DOCTYPE …. > (old, not allowed with SOAP).
or– XML schema
![Page 28: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/28.jpg)
Grid Computing, B. Wilkinson, 2004 3a.28
XML Schema
• Flexible way of handing legal element names. Expressed in XML.
• Schema is an XML document with required definitions.
• Handles namespaces.
• Has notation of data types
![Page 29: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/29.jpg)
Grid Computing, B. Wilkinson, 2004 3a.29
XML schema
Document
xsi:schemaLocation=“ .. “
![Page 30: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/30.jpg)
Grid Computing, B. Wilkinson, 2004 3a.30
XML Schema StructureExample
<?xml version=“1.0” encoding=“UTF-8”?>
<xsd:schema xmlns=“http://www.skatestown.com/ns/po”
xmlns:xsd=“http://www.w3.org/2001/XMLSchema”
targetNamespace=http://www.skatestown.com/ns/po”>
<xsd:annotations>
<xsd:documentation xml:lang=“en”>
Purchase order schema for SkatesTown.
</xsd:documentation>
</xsd:annotation>.
.
.
</xsd:schema>From: “Building Web Services with Java, making sense of XML, SOAP, WSDL, and UDDI, 2nd ed”
by S. Graham et al, SAMS publishing, 2004, p 54.
![Page 31: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/31.jpg)
Grid Computing, B. Wilkinson, 2004 3a.31
Associating schema to documentExample
<?xml version=“1.0” encoding=UTF-8”?>
<po:po xmlns:po=“http://www.skatestown.com/ns/po”
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=“http://www.skatestown.com/ns/po
http://www.skatestown.com/schema/po.xsd”
id=“43871” submitted=“2001-10-05”>.
.
.
</po:po>
From: “Building Web Services with Java, making sense of XML, SOAP, WSDL, and UDDI, 2nd ed” by S. Graham et al, SAMS publishing, 2004, p 54.
![Page 32: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/32.jpg)
Grid Computing, B. Wilkinson, 2004 3a.32
Additional XML materialsOn-line materials
• W3C consortium home page:
http://www.w3.org/XML/
• W3Schools XML Tutorial :
http://www.w3schools.com/xml/
![Page 33: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/33.jpg)
Grid Computing, B. Wilkinson, 2004 3a.33
Books
Several books on XML, e.g.:
“Building Web Services with Java: Making sense of XML, SOAP, WSDL, and UDDI, 2nd edition”
by S. Graham et al, SAMS publishing, 2004
Very good but 792 pages!!
![Page 34: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/34.jpg)
Grid Computing, B. Wilkinson, 2004 3a.34
Additional SOAP materials
See:
http://www.w3c.org/TR/soap
![Page 35: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/35.jpg)
Grid Computing, B. Wilkinson, 2004 3a.35
Hosting Environments for Web Services
• Microsoft .NET
• IBM Websphere
• Apache Axis - we will be using this for assignment 1
![Page 36: WEB SERVICES Introduction](https://reader035.fdocuments.us/reader035/viewer/2022062322/5681493b550346895db6824e/html5/thumbnails/36.jpg)
Grid Computing, B. Wilkinson, 2004 3a.36
More information on Axis
http://xml.apache.org/axis