You are on page 1of 19

Web Services

CS-422
What are Web Services
• New breed of Web application
– self-contained
– self describing
– modular
• once published
– can be discovered
– located
– and invoked across the web
• application components
Web Services Platform
• Basic platform is XML and HTTP
– HTTP is ubiquitous
• could be done with RMI, Jini, CORBA or DCOM
but they aren’t everywhere the way HTTP is
– middleware isn’t always interoperable
• HTTP and the Web are simple
• the Web is a great information distribution vehicle
• the Web is a good way to tie middleware tools
together
– HTTP wrappering has been around for a long time
– CORBA has used it forever to work through firewalls
To fill out the platform
– XML provides a metalanguage for
– SOAP (remote invocation)
– UDDI (trader, directory service)
– WSDL (expression of service characteristics)
– XLANG/XAML (transaction support)
– XKMS (XML Key management)
– XFS(Xmethods File System)
SOAP
• Simple Object Access Protocol
• defines a protocol for a uniform way of passing XML-encoded data, it
also defines a way to perform remote procedure calls (RPCs) using
HTTP as the underlying communication protocol
• the need for SOAP arises from the realization that the current
middleware offerings, to be easy to use, need a WAN wrapper (HTTP)
• sending messages as XML can ensure interoperability
– middleware vendors are willing to include the tools for parsing and
serializing XML in order to scale their approaches to wider networks
• SOAP is currently under the care of W3C and is frozen until such time
that the W3C deems changes necessary
SOAP Message Embedded in HTTP Request

POST /StockQuote HTTP/1.1


Host: www.stockquoteserver.com
Content-Type: text/xml; charset="utf-8"
Content-Length: nnnn
SOAPAction: "Some-URI"

<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<m:GetLastTradePrice xmlns:m="Some-URI">
<symbol>DIS</symbol>
</m:GetLastTradePrice>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
SOAP Message Embedded in HTTP Response

HTTP/1.1 200 OK
Content-Type: text/xml; charset="utf-8"
Content-Length: nnnn

<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<SOAP-ENV:Body>
<m:GetLastTradePriceResponse xmlns:m="Some-URI">
<Price>34.5</Price>
</m:GetLastTradePriceResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
UDDI
• Universal Description, Discovery and Integration Service
• provides a mechanism for clients to dynamically find other web
services
– similar to a CORBA trader
– think of it as a DNS service for business applications
• a UDDI registry has two kinds of clients
– those that want to publish a service (and its usage interfaces)
– those who want to obtain services of a certain kind and bind to them
• UDDI is layered over SOAP and assumes that requests and responses
are UDDI objects send around as SOAP messages
UDDI Example

The following query, when placed inside the body of the SOAP envelope, returns
details on Microsoft.

<find_business generic="1.0" xmlns="urn:uddi-org:api">


<name>Microsoft</name>
</find_business>
Returns ...
<businessList generic="1.0"
operator="Microsoft Corporation"
truncated="false"
xmlns="urn:uddi-org:api">
<businessInfos>
<businessInfo
businessKey="0076B468-EB27-42E5-AC09-9955CFF462A3">
<name>Microsoft Corporation</name>
<description xml:lang="en">
Empowering people through great software -
any time, any place and on any device is Microsoft's
vision. As the worldwide leader in software for personal
and business computing, we strive to produce innovative
products and services that meet our customer's
</description>
<serviceInfos>
<serviceInfo
businessKey="0076B468-EB27-42E5-AC09-9955CFF462A3"
serviceKey="1FFE1F71-2AF3-45FB-B788-09AF7FF151A4">
<name>Web services for smart searching</name>
</serviceInfo>
<serviceInfo
businessKey="0076B468-EB27-42E5-AC09-9955CFF462A3"
serviceKey="8BF2F51F-8ED4-43FE-B665-38D8205D1333">
<name>Electronic Business Integration Services</name>
</serviceInfo>
.
.
</businessInfo>
</businessInfos>
</businessList>
WSDL
• Web Services Definition Language
• provides a way for service providers to describe the basic format of
web service requests over different protocols or encodings
• used to describe
– what a web service can do
– where it resides
– how to invoke it
• UDDI registries describe many aspects of web services including the
binding details. WSDL fits into the subset of a UDDI service
description
• WSDL provides a template for how services should be describes and
bound by their clients
WSDL (more…)
• WSDL defines services as collections of network endpoints or ports
• the abstract definition of endpoints and messages is separated from
their concrete network deployment or data format bindings
– this allows reuse of abstract definitions of messages which are abstract
definitions of the data exchanged and port types which are abstract
definitions of collections of operations
• a port is defined by associating a network address with a reusable
binding, a collection of ports define a service
WSDL Element Types
• Types - a container for data type definitions using some system ( like
XSD)
• Messages - an abstract, typed definition of data being communicated
• Operations - an abstract description of an action supported by the
service
• Port Type - an abstract set of operations supported by one ot more
endpoints
• Binding - a concrete protocol and data format specification for a
particular port type
• Port - a single endpoint defined as a combination of a binding and a
network address
• Service - a collection of related endpoints
Sample
<?xml version="1.0"?>
<definitions name="StockQuote"
targetNamespace="http://example.com/stockquote.wsdl"
xmlns:tns="http://example.com/stockquote.wsdl"
xmlns:xsd1="http://example.com/stockquote.xsd"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<schema targetNamespace="http://example.com/stockquote.xsd"
xmlns="http://www.w3.org/1999/XMLSchema"> <element name="TradePriceRequest">
<complexType>
<all>
<element name="tickerSymbol" type="string"/>
</all>
</complexType>
</element>
<element name="TradePrice">
<complexType>
<all>
<element name="price" type="float"/>
</all>
</complexType>
</element>
</schema>
</types> (cont.)
<message name="GetLastTradePriceInput">
<part name="body" element="xsd1:TradePriceRequest"/>
</message>
<message name="GetLastTradePriceOutput">
<part name="body" element="xsd1:TradePrice"/>
Sample (cont.)
</message>

<portType name="StockQuotePortType">
<operation name="GetLastTradePrice">
<input message="tns:GetLastTradePriceInput"/>
<output message="tns:GetLastTradePriceOutput"/>
</operation>
</portType>
<binding name="StockQuoteSoapBinding"
type="tns:StockQuotePortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="GetLastTradePrice">
<soap:operation
soapAction="http://example.com/GetLastTradePrice"/>
<input>
<soap:body use="literal"
namespace="http://example.com/stockquote.xsd"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="literal"
namespace="http://example.com/stockquote.xsd"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
.
.
XLANG
• Optional to the Web Services Platform
• Stands for eXtensible Language
• XLang is a notation for expressing the compensatory actions for any
request that needs to be undone. The web services infrastructure can
leverage XLang specifications to perform complex undo operations.
XAML
• Transaction Authority Markup Language
• provides a traditional two-phase commit transactional semantics over
web services
XKMS
• XML Key Management Specification
• an effort by Microsoft and Verisign to integrate PKI and digital
certificates (which are used for securing Internet transactions) with
XML applications
• The key idea is to delegate the signature processing to a trust server on
the Web, so that thin or mobile clients don't have to carry around the
smarts to do all this themselves.
• XKMS relies on the XML Signature specification already being
worked on by W3C and on anticipated work at W3C on an XML
encryption specification.
XFS
• XMethods File System
• The XMethods filesystem service enables you to post and read files
via a SOAP interface.
• This system enables developers to create services that utilize
centralized, persistent data. Ideally, this type of filesystem can be used
to centralize the storage of information which can be accessed by
multiple nodes.
– For example, one could use this space to support automatic patch updates.
XFS provides a client tool that integrates the XFS web service into a
Windows Explorer shell. Windows Explorer is then integrated with the
XML-SOAP-based file system.
• XFS is an open-source initiative by xmethods.com, the momentum of
which is unclear. However, the idea is technically attractive

You might also like