basic standards for web services cs 696 – services computing fall 2008
DESCRIPTION
Basic Standards for Web Services CS 696 – Services Computing Fall 2008. Chapter 2: Service-Oriented Computing: Semantics, Processes, Agents – Munindar P. Singh and Michael N. Huhns, Wiley, 2005. Highlights of this Chapter. eXtensible Markup Language (XML) - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/1.jpg)
1
Basic Standards for Web ServicesCS 696 – Services Computing
Fall 2008
Chapter 2: Service-Oriented Computing: Semantics,
Processes, Agents – Munindar P. Singh and Michael N. Huhns, Wiley, 2005
![Page 2: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/2.jpg)
2
Highlights of this Chapter
eXtensible Markup Language (XML) Simple Object Access Protocol
(SOAP) Web Services Description
Language (WSDL) Directory Services Universal Description, Discovery,
and Integration (UDDI)
![Page 3: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/3.jpg)
3
Standards for Web Services
BPEL4WSOWL-S Service
Model
ebXMLCPA
Process and workfloworchestrations
QoS: Servicedescriptions and bindings
Contracts andagreements
XLANG
WSCL
WSDLebXML
CPP
ebXMLBPSS
XML, DTD, and XML Schema
HTTP, FTP, SMTP, SIP, etc.
SOAPebXML
messaging
OWL
UDDIebXML
Registries
WSCLWSCI
WS-Coordination
WS-AtomicTransaction and WS-BusinessActivity
OWL-S ServiceGrounding
OWL-S ServiceProfile
BTP
BPML
Discovery
Messaging
Transport
QoS: Conversations
QoS: Choreography
QoS: Transactions
Encoding
WS-Policy
WS-Security
WS-ReliableMessaging
PSL
RDF
![Page 4: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/4.jpg)
4
XML Web Service Foundation
Open and with broad industry support
Publish, Find, Use Services UDDI
Service Interactions SOAP
Universal Data Format XML
Description Language WSDL
Ubiquitous Communications TCP/IP, HTTP, SMTP, SIP, Reliable messaging
Security (authentication and authorization) WS-Security, SAML
![Page 5: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/5.jpg)
5
Markup History
None, as in comma separated values Ad hoc tags SGML (Standard Generalized Markup L):
complex, few reliable tools HTML (HyperText ML): simple,
unprincipled, mixes structure and display XML (eXtensible ML): simple, yet
extensible subset of SGML to capture new vocabularies Machine processible Comprehensible to people: easier debugging
![Page 6: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/6.jpg)
6
Brief Introduction to XML
Basics Parsing Storage Transformations
![Page 7: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/7.jpg)
7
XML Basics and Namespaces
<?xml version="1.0"?> <!– not part of the document per se <arbitrary:toptag xmlns=“http://one.default.namespace/if-needed”
xmlns:arbitrary=“http://wherever.it.might.be/arbit-ns” xmlns:random=“http://another.one/random-ns”> <arbitrary:atag attr1=“v1” attr2=“v2”>
Optional text also known as PCDATA<arbitrary:btag attr1=“v1” attr2=“v2” />
</arbitrary:atag><random:simple_tag/><random:atag attr3=“v3”/> <!–compare with arbitrary:atag
</arbitrary:toptag>
![Page 8: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/8.jpg)
8
XML Example
<?xml version="1.0"? Encoding=‘UTF-8’?><temperature scale=“Celsius”> <value>25</value>
<accuracy>2</accuracy> <ambience condition=“shade”/>
</temperature>
![Page 9: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/9.jpg)
9
XML Example
<?xml version="1.0"?><temperature accuracy=“2” scale=“Celsius”> 25
<ambience condition=“shade”/></temperature>
![Page 10: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/10.jpg)
10
HTML Example of same data<TABLE BORDER=1> <TR> <TH>Value</TH> <TH>Accuracy</TH> <TH>Scale</TH> <TH>Ambience Condition</TH> </TR> <TR>
<TD>25</TD> <TD>2</TD> <TD>Celsius</TD> <TD>Shade</TD>
</TR></TABLE>
![Page 11: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/11.jpg)
11
XML Query Languages
XPath XPointer XSLT XQuery
![Page 12: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/12.jpg)
12
XPath
Model XML documents as trees with nodes Elements Attributes Text (PCDATA) Comments Root node: above root of document
![Page 13: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/13.jpg)
13
XPath
Parent in XPath is like parent as traditionally in computer science
Child in XPath is confusing: An attribute is not the child of its
parent Makes a difference for certain kinds of
recursion (e.g., apply-templates discussed in XSLT)
![Page 14: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/14.jpg)
14
XPath Paths
Leading /: root /: indicates walking down a tree .:current node ..:parent node @attr: to access values for the
given attribute text() comment()
![Page 15: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/15.jpg)
15
XPath Navigation
Select children according to position, e.g., [j], where j could be 1 … last()
Descendant-or-self operator, // .//elem finds all elems under the
current //elem finds all elems in the document
Wildcard, *: @*: finds all attribute values
![Page 16: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/16.jpg)
16
XPath Queries
Incorporate selection conditions in XPath Attributes: //Song[@genre=“jazz”] Elements: //Song[starts-with(.//group, “Led”)] Existence of attribute: //Song[@genre] Existence of subelement: //Song[group] Boolean operators: and, not, or Set operator: union (|); none others Arithmetic operators: >, <, … String functions: contains(), concat(), length(), Aggregates: sum(), count()
![Page 17: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/17.jpg)
17
XPointer
Combines XPath with URLs URL to get to a document; XPath to
walk down the document Can be used to formulate queries,
e.g., Song-URL#xpointer(//
Song[@genre=“jazz”])
![Page 18: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/18.jpg)
18
XSLT
A functional programming language
A stylesheet specifies transformations on a document<?xml version=“1.0”?><?xml-stylesheet type=“text/xsl”
href=“URL-to-dot-xsl”?> <!– the sheet to use <main-tag>…</main-tag>
![Page 19: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/19.jpg)
19
XSLT Stylesheets
Use the XSLT namespace, conventionally abbreviated as xsl Includes primitives: Copy-of <for-each select=“…”> <if test=“…”> <choose >
![Page 20: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/20.jpg)
20
XML file referencing XSL stylesheet
<?xml version=“1.0”?><?xml:stylesheet type=“text/xsl” href=“TempTable.xsl”?> <TempCollection> <temperature scale=“Celsius”> <value>25</value> <accuracy>2</accuracy> </temperature> <temperature scale=“Kelvin”> <value>123</value> <accuracy>5</accuracy> </temperature> <temperature scale=“Fahrenheit”> <value>32</value> <accuracy>1</accuracy> </temperature> </TempCollection>
![Page 21: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/21.jpg)
21
Stylesheet (TempTable.xsl)
<xsl:Stylesheet version=“1.0” xmlns:xsl=“http://www.w3.org/1999/XSL/Transform”> <xsl:template match=“/”> <HTML> <BODY> <xsl:apply-templates /> </BODY> </HTML> </xsl:template> <xsl:template match=“TempCollection”> <TABLE BORDER=“2”> <TR> <TH>Value</TH> <TH>Accuracy</TH> <TH>Scale</TH> </TR> <xsl:apply-templates/> </TABLE> </xsl:template> <xsl:template match=“temperature”> <TR> <TD><xsl:value-of select=“value”/></TD> <TD><xsl:value-of select=“accuracy”/></TD> <TD><xsl:value-of select=“@scale”/></TD> </TR> </xsl:template></xsl:stylesheet>
![Page 22: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/22.jpg)
22
XSLT Templates: 1
A pattern to specify where a given transform should apply This match only works on the root:<xsl:template match=“/”>…</xsl:template>
![Page 23: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/23.jpg)
23
XSLT Templates: 2
Can be applied recursively on the children via
<xsl:apply-templates/>
By default, if no other template matches, recursively apply to children of current node (ignores attributes) and to root:
<xsl:template match=“*|/”><xsl:apply-templates/>
</xsl:template>
![Page 24: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/24.jpg)
24
Parsing and Validating An XML document maps to a parse tree.
Each tag ends once: nesting structure (one root) Each attribute occurs at most once; quoted string
Well-formed XML documents can be parsed Applications have an explicit or implicit syntax
for their particular XML-based tags If explicit, may be expressed in DTDs and XML
Schemas Best referred to definitions elsewhere XML Schemas, expressed in XML, are superior to DTDs
When docs are produced by external components, they should be validated
![Page 25: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/25.jpg)
25
DTD (Document Type Definition) Example
<?xml version="1.0"? Encoding=‘UTF-8’?><TempCollection> <temperature scale=“Celsius”> <value>25</value>
<accuracy>2</accuracy> <ambience condition=“shade”/> </temperature></TempCollection>
<?xml encoding="UTF-8"?><!ELEMENT TempCollection (temperature)+><!ELEMENT temperature (value, accuracy,ambience)><!ELEMENT value (#PCDATA)><!ELEMENT accuracy (#PCDATA)><!ELEMENT ambience (#EMPTY)><!ATTLIST temperature scale (Celsius|Fahrenheit|Kelvin)
#REQUIRED><!ATTLIST ambience condition CDATA “shade”>
#PCDATA – Parsed Character data, can contain markup CDATA – Character data, is not parsed for markup
![Page 26: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/26.jpg)
26
XML Schema A data definition language for XML: defines
a notion of schema validity; helps us define desired grammars for documents Same syntax as regular XML documents Local scoping of subelement names Incorporates namespaces Types
Primitive (built-in): string, ID, IDREF, integer, float, date,
simpleType constructors: list, union Restrictions: intervals, lengths, enumerations, regex
patterns, Flexible ordering of elements
Key and referential integrity constraints
![Page 27: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/27.jpg)
27
XML Schema example
<?xml version=“1.0”?><xsd:schema xmlns:xsd=“http://www.w3.org/2001/XMLSchema” … ><xsd:element name="TempCollection"> <xsd:complexType> <xsd:sequence> <xsd:element ref="temperature" minOccurs="1" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element>
<xsd:element name="temperature"> <xsd:complexType> <xsd:sequence> <xsd:element ref="value" minOccurs="1" maxOccurs="1"/> <xsd:element ref="accuracy" minOccurs="1" maxOccurs="1"/> </xsd:sequence> <xsd:attributeGroup ref="TempAttributes"/> </xsd:complexType> </xsd:element>
![Page 28: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/28.jpg)
28
XML Schema example
<xsd:attributeGroup name="TempAttributes">
<xsd:attribute name="scale" use="required"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:pattern value="Celsius"/> <xsd:pattern value="Fahrenheit"/> <xsd:pattern value="Kelvin"/> </xsd:restriction> </xsd:simpleType> </xsd:attribute> </xsd:attributeGroup> <xsd:element name="value" type="xsd:integer"/> <xsd:element name="accuracy" type="xsd:nonNegativeInteger"/>
</xsd:schema>
![Page 29: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/29.jpg)
29
XML Schema: complexType
Specifies types of elements with structure: Must use a compositor if > 1
subelements Subelements with types Min and max occurrences (default 1)
of subelements
![Page 30: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/30.jpg)
30
XML Schema: Compositors
Sequence: ordered Can occur within other compositors Allows varying min and max occurrence
All: unordered Must occur directly below root element Max occurrence of each element is 1
Choice: exclusive or Can occur within other compositors
![Page 31: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/31.jpg)
31
XML Schema: Key Namespaces
http://www.w3.org/2001/XMLSchema Conventional prefix: xsd Terms for defining schemas: schema, element,
attribute, … The tag schema has an attribute
targetNamespace http://www.w3.org/2001/XMLSchema-
instance Conventional prefix: xsi Terms for use in instances: schemaLocation, null
targetNamespace: user-defined
![Page 32: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/32.jpg)
32
XML Schema Instance Doc
<Music xmlns=http://a.b.c/Muse
xmlns:xsi=“the standard-xsi”xsi:schemaLocation=“a-schema-as-
a-URI a-schema-location-as-a-URL”>
…</Music>
![Page 33: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/33.jpg)
33
Creating Schema Docs: 1
<schema xmlns=“the-standard-xsd”targetNamespace=“the-
target”> <include schemaLocation=“part-
one.xsd”/> <include schemaLocation=“part-
two.xsd”/></schema>
![Page 34: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/34.jpg)
34
Creating Schema Docs: 2
Use imports instead of include Specify namespaces from which
schemas are to be imported Location of schemas not required and
may be ignored if provided
![Page 35: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/35.jpg)
35
Document Object Model (DOM)
Basis for parsing XML, which provides a node-labeled tree in its API Conceptually simple: traverse by requesting
tag, its attribute values, and its children Processing program reflects document
structure Can edit documents Inefficient for large documents: parses them
first entirely to build the tree even if a tiny part is needed
![Page 36: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/36.jpg)
36
DOM Example [Simeoni 2003]
Element s = d.getDocumentElement();NodeList l =
s.getElementsByTagName(“member”); Element m = (Element) l.item(0);int code = m.getAttribute(“code”);NodeList kids = m.getChildNodes();Node kid = kids.item(0);String tagName =
((Element)kid).getTagName();…
![Page 37: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/37.jpg)
37
Simple API for XML (SAX)
Parser generates a sequence of events: startElement, endElement, …
Programmer implements these as callbacks More control for the programmer
Processing program does not reflect document structure
![Page 38: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/38.jpg)
38
SAX Example [Simeoni 2003]
class MemberProcess extends DefaultHandler {public void startElement (String uri, String n,
String qName, Attributes attrs) {if (n.equals(“member”)) code = attrs.getValue(“code”);if (n.equals(“project”)) inProject = true;buffer.reset(); }
public void endElement (String uri, String n, String qName) {if (n.equals(“project”)) inProject = false;if (n.equals(“member”) && !inProject)
name = buffer.toString().trim(); } }
![Page 39: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/39.jpg)
39
Programming with XML
Current approaches concentrate on structure but ignore meaning Difficult to construct and maintain Treat everything as a string Inadequate type checking can hide
errors Emerging approaches (e.g., JAXB)
provide superior binding from XML to programming languages Primitives such as unmarshal to
materialize an object from XML
![Page 40: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/40.jpg)
40
Uses of XML
Exchanging information across software components
Storing information in nonproprietary format
XML documents represent structured descriptions: Products, services, catalogs Contracts Queries, requests, invocations (as in SOAP)
Data-centric versus document-centric (irregular, heterogeneous data, depend on entire doc for app-specific meaning) views
![Page 41: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/41.jpg)
41
Data-Centric View<relation>
<tuple><attr1>V11</attr1>… <attrn>V1n</attrn></tuple>…<tuple><attr1>Vm1</attr1>… <attrn>Vmn</attrn></tuple>
</relation> Extract and store into DB via
mapping to DB model Regular, homogeneous tags May be expensive if repeatedly
parsed and instantiated
![Page 42: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/42.jpg)
42
Document-Centric View
Storing docs in DBs Use character large objects (clobs)
within DB Store paths to external files containing
docs Combine with some structured
elements with search conditions for both structured elements and unstructured clobs or files
Heterogeneity also complicates mappings to traditional typed OO programming languages
![Page 43: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/43.jpg)
43
Directions Limitations of XML
Doesn’t represent meaning Enables multiple representations for the
same information; transform if models known
Trends: sophisticated approaches for Querying and manipulating XML, e.g.,
XSLT Binding to PLs and DBs Semantics, e.g., RDF, DAML, OWL, …
![Page 44: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/44.jpg)
44
XML Summary
XML enables information sharing XML is well established
Several aspects are worked out Lots of tools Works with databases and
programming languages XML provides a useful substrate for
service-oriented computing
![Page 45: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/45.jpg)
45
Web Services: Basic Architecture
ServiceBroker
ServiceProvider
ServiceRequesto
r
Bind or invoke(SOAP)
Find or discover(UDDI)
Publish or announce(WSDL)
Registry; well-known
Not well-known
![Page 46: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/46.jpg)
46
Basic Profile (BP 1.0)
The Web Services Interoperability Organization (WS-I) has specified the following Basic Profile version 1.0: SOAP 1.1 HTTP 1.1 XML 1.0 XML Schema Parts 1 and 2 UDDI Version 2 WSDL 1.1
![Page 47: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/47.jpg)
47
Describing a Service
Namee.g., GetTemperature
Types of Input Parameterse.g., (String, String)
Types of Output Parameterse.g., Integer
![Page 48: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/48.jpg)
48
Interactions
Via MethodsVia Methods Via MessagesVia Messages
Purchasing()Purchasing()
CatalogService()CatalogService()
Order()Order()
invokeinvoke
invokeinvoke
catalogcatalog
confirmation #confirmation #
Dell Purchasing Intel Sales
SubmitPO
AckPO
SubmitASN
SubmitInvoice
SubmitPayment
![Page 49: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/49.jpg)
49
SOAP (Simple Object Access Protocol)
Used to exchange messages via HTTP, SMTP, and SIP (Session Initiation Protocol for Internet telephony)
Originally designed for remote-procedure calls (RPC)
Works through firewalls on port 80 Character-based, so easy to encrypt/decrypt
and thus easy to secure Inefficient due to character, not binary, data
and large headers Does not describe bidirectional or n-party
interaction
![Page 50: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/50.jpg)
50
Ex. SOAP Request
POST /temp HTTP/1.1Host: www.socweather.comContent-Type: text/xml; charset="utf-8"Content-Length: xxxSOAPAction: "http://www.socweather.com/temp"
<!-- The above are HTTP headers --><?xml version=“1.0”?><env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> <env:Body> <m:GetTemp xmlns:m="http://www.socweather.com/temp.xsd"> <m:City>Honolulu</m:City> <m:When>now</m:When> </m:GetTemp> </env:Body></env:Envelope>
![Page 51: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/51.jpg)
51
Ex. SOAP Response
HTTP/1.1 200 OKContent-Type: text/xml; charset="utf-8"Content-Length: xxxSOAPAction: "http://www.socweather.com/temp"
<?xml version=“1.0”?><env:Envelope
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<env:Body> <m:GetTempResponse
xmlns:m="http://www.socweather.com/temp.xsd"> <DegreesCelsius>30</DegreesCelsius> </m:GetTempResponse> </env:Body></env:Envelope>
![Page 52: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/52.jpg)
52
WSDL: Web Services Description Language
Describes a programmatic interface to a Web service, including Definitions of data types Input and output message formats The operations provided by the service Network addresses Protocol bindings
![Page 53: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/53.jpg)
53
WSDL Data Model definitions targetNamespace=thisNamespace xmins:tns=thisNamespace
types message name=in message name=out
portType name=foo operation input message=tns:in output message=tns:out
binding name=foobar type=tns:foo [binding information]
service name=foobar Service
Port name=foobarPort binding=tns:foobar [endpoint information]
Types contains data type definitionsMessages consist of one or more parts
A portType describes an abstract setof operations
A binding describes a concrete set offormats and protocols for the fooportTypes
A port describes an implementationof the foobar binding
![Page 54: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/54.jpg)
54
WSDL Example
<?xml version="1.0"?><!-- the root element, wsdl:definitions, defines a set of --><!-- related services --><wsdl:definitions name="Temperature" targetNamespace="http://www.socweather.com/schema" xmlns:ts="http://www.socweather.com/TempSvc.wsdl"
xmlns:tsxsd="http://schemas.socweather.com/TempSvc.xsd"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
![Page 55: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/55.jpg)
55
WSDL Example
<!-- wsdl:types encapsulates schema definitions of communication types -->
<wsdl:types> <!-- all type declarations are expressed in xsd --> <xsd:schema targetNamespace="http://namespaces.socweather.com" xmlns:xsd="http://www.w3.org/1999/XMLSchema"> <!-- xsd def: GetTemp [City string, When string] --> <xsd:element name="GetTemp"> <xsd:complexType> <xsd:sequence> <xsd:element name="City" type="string"/> <xsd:element name="When" type="string"/> </xsd:sequence> </xsd:complexType> </xsd:element>
![Page 56: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/56.jpg)
56
WSDL Example <!-- xsd def: GetTempResponse [DegreesCelsius integer] --> <xsd:element name="GetTempResponse"> <xsd:complexType> <xsd:all> <xsd:element name="DegreesCelsius" type="integer"/> </xsd:all> </xsd:complexType> </xsd:element>
<!-- xsd def: GetTempFault [errorMessage string] --> <xsd:element name="GetTempFault"> <xsd:complexType> <xsd:all> <xsd:element name="errorMessage" type="string"/> </xsd:all> </xsd:complexType> </xsd:element> </xsd:schema></wsdl:types>
![Page 57: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/57.jpg)
57
WSDL Example<!-- wsdl:message elements describe potential transactions -->
<!-- request GetTempRequest is of type GetTemp --><wsdl:message name="GetTempRequest"> <wsdl:part name="body" element="tsxsd:GetTemp"/></wsdl:message>
<!-- response GetTempResponse is of type GetTempResponse --><wsdl:message name="GetTempResponse"> <wsdl:part name="body" element="tsxsd:GetTempResponse"/></wsdl:message>
<!-- wsdl:portType describes messages in an operation --><wsdl:portType name="GetTempPortType"> <wsdl:operation name="GetTemp"> <!-- The order of input and output is significant; <!-- input preceding output indicates the request-response operation type --> <wsdl:input message="ts:GetTempRequest"/> <wsdl:output message="ts:GetTempResponse"/> <wsdl:fault message="ts:GetTempFault"/> </wsdl:operation> </wsdl:portType>
![Page 58: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/58.jpg)
58
WSDL Example<!-- wsdl:binding states a serialization protocol for this service --><wsdl:binding name="TempSvcSoapBinding" type="ts:GetTempPortType">
<!-- leverage off soap:binding document style --> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <!-- semi-opaque container of network transport details classed by soap:binding above
--> <wsdl:operation name="GetTemp">
<!-- further specify that the messages in the wsdl:operation "GetTemp" use SOAP -->
<soap:operation soapAction="http://www.socweather.com/TempSvc"/> <wsdl:input> <soap:body use="literal"
namespace="http://schemas.socweather.com/TempSvc.xsd"/> </wsdl:input> <wsdl:output> <soap:body use="literal"
namespace="http://schemas.socweather.com/TempSvc.xsd"/> </wsdl:output> <wsdl:fault> <soap:body use="literal"
namespace="http://schemas.socweather.com/TempSvc.xsd"/> </wsdl:fault> </wsdl:operation></wsdl:binding>
![Page 59: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/59.jpg)
59
WSDL Example
<wsdl:service name="TemperatureService">
<wsdl:documentation>socweather.com temperature service </wsdl:documentation>
<!-- connect it to the binding "TempSvcSoapBinding" above --> <wsdl:port name="GetTempPort"
binding="ts:TempSvcSoapBinding"> <!-- give the binding a network address --> <soap:address
location="http://www.socweather.com/TempSvc"/> </wsdl:port>
</wsdl:service>
</wsdl:definitions>
![Page 60: Basic Standards for Web Services CS 696 – Services Computing Fall 2008](https://reader036.vdocuments.mx/reader036/viewer/2022062807/5681512f550346895dbf492f/html5/thumbnails/60.jpg)
60
Directory Services Support discovery: enable applications,
agents, Web service providers, Web service requestors, people, objects, and procedures to locate each other White pages – entries found by name Yellow pages – entries found by characteristics
and capabilities A basic directory might be a simple
database (passive) or a broker/facilitator (active, that provides alerts and recruits participants)
UDDI – both white pages and yellow pages, but passive