Professional Documents
Culture Documents
of SOA) - Web Services Architecture (Transport Services, Messaging Services, Service Description,
Discovery Services, Quality of Service), Interoperability REST (Representational State Transfer)
Services.
Service-oriented architectures
SOA is a logical way of designing a software system to provide services to either end-user
applications or to other services distributed in a network, via published and discoverable
interfaces.
A means of developing distributed systems where the components are stand-alone services.
Standard protocols have been developed to support service communication and information
exchange.
Services or components?
Benefits of SOA
Web services
Key standards
Defines the components of a service specification that may be used to discover the
existence of a service.
Service-oriented architecture(ABOVE DIAGRAM)
The Web Services architecture is based upon the interactions between three roles: i) service
provider, ii) service registry and iii) service requestor.
Together, these roles and operations act upon the Web Services artifacts: the Web service
software module and its description.
The service provider defines a service description for the Web service and publishes it to a
service requestor or service registry.
The service requestor uses a find operation to retrieve the service description locally or from the
service registry and uses the service description to bind with the service provider and invoke or
interact with the Web service implementation.
Service provider and service requestor roles are logical constructs and a service can exhibit
characteristics of both.
These behaviors can occur singly or iteratively. In detail, these operations are:
Find. In the find operation, the service requestor retrieves a service description directly or
queries the service registry for the type of service The find operation can be involved in two
different lifecycle phases for the service requestor: at design time to retrieve the services
interface description for program development, and at runtime to retrieve the services binding
and location description for invocation.
Bind. Eventually, a service needs to be invoked. In the bind operation the service requestor
invokes or initiates an interaction with the service at runtime using the binding details in the
service description to locate, contact and invoke the service.
Service provider
From a business perspective, this is the owner of the service. From a Service provider. architectural
perspective, this is the platform that hosts access to the service.
Service requestor
From a business perspective, this is the business that requires Service requestor certain functions to be
satisfied. From an architectural perspective, this is the application that is looking for and invoking or
initiating an interaction with a service. The service requestor role can be played by a browser driven by a
person or a program without a user interface, for example another Web service.
Service registry
This is a searchable registry of service descriptions where service Service registry. providers publish their
service descriptions. Service requestors find services and obtain binding information (in the service
descriptions) for services during development for static binding or during execution for dynamic binding.
For statically bound service requestors, the service registry is an optional role in the architecture,
because a service provider can send the description directly to service requestors.
The Web services community has done significant work to address this interoperability issue,
and since the introduction of the first Web services, various organizations have introduced other
Web servicesrelated specifications.
Web services specifications that realize more concretely the capabilities that are described in
the SOA framework.
The specifications define formats and protocols that allow services to interoperate across those
vendor platforms that provide conformant implementations, either natively or by mapping them
onto existing proprietary middleware offerings
Transport Services:
We can transport Web services messages by using the ubiquitous Web protocols such as
Hypertext Transport Protocol (HTTP) or Secure HTTP (HTTPS).
We can also transport them over any communications protocol such SMTP, TCP/IP, RMI/IIOP.
IIOP (Internet Inter-ORB Protocol) is a protocol that makes it possible for distributed programs
written in different programming languages to communicate over the Internet.
Messaging Services:
The messaging services component of the framework contains the most fundamental Web
services specifications and technologies, including eXtensible Markup Language (XML), SOAP,
and WS-Addressing.
XML provides the interoperable format to describe message content between Web services and
is the basic language in which the Web services specifications are defined.
1. XML is extensible: XML allows you to create your own self-descriptive tags, or language, that
suits your application.
2. XML carries the data, does not present it: XML allows you to store the data irrespective of how it
will be presented.
3. XML is a public standard: XML was developed by an organization called the World Wide Web
Consortium (W3C) and is available as an open standard.
XML Usage
XML can be used to exchange the information between organizations and systems.
XML can be used to store and arrange the data, which can customize your data handling needs.
XML can easily be merged with style sheets to create almost any desired output.
<definitions targetNamespace=...>
<xsd:schema>
<xsd:import namespace=http://www.purchase.com/xsd/svp-svc>
</xsd:schema>
</types>
<message name=purchaseResponse>
</message>
SOAP, one of the significant underpinnings of Web services, provides a simple and relatively
lightweight mechanism for exchanging structured and typed information between services.
SOAP is designed to reduce the cost and complexity of integrating applications that are built on
different platforms.
SOAP defines an extensible enveloping mechanism that scopes and structures the message
exchange between Web services.
I. an envelope,
II. a header,
and a body.
ENVELOPE :The envelope is the root element of the SOAP message. It contains an optional
header element and a mandatory body element.
HEADER: Contains any optional attributes of the message used in processing the message.
SOAP defines several well-known attributes that you can use to indicate who should deal with a
header block and whether processing of it is optional or mandatory
BODY :The body element is always the last child element of the envelope, and it is the container
for the payloadthe actual message content that is intended for the ultimate recipient who will
process it.
Fault An optional Fault element that provides information about errors that occur while
processing the message
<?xml version="1.0"?>
<SOAP-ENV:Header>
...
</SOAP-ENV:Header>
<SOAP-ENV:Body>
...
<SOAP-ENV:Fault>
...
</SOAP-ENV:Fault>
...
</SOAP-ENV:Body>
</SOAP_ENV:Envelope>
WS-Addressing:
It decouples address information from the specific transport used by providing a mechanism to
place the target, source, and other important address information directly within the Web
service message.
Identify Web services endpoints and to secure end-to end endpoint identification in messages
1. Endpoint References
2. Message Information Headers.
A Web services endpoint is a referenceable entity, processor, or resource in which Web services
messages can be targeted
An endpoint reference (EPR) is an XML structure encapsulating information useful for addressing
a message to a Web service
This includes the destination address of the message, any additional parameters (called
reference parameters) necessary to route the message to the destination, and optional
metadata (such as WSDL or WS-Policy) about the service.
Service Description
Service description defines metadata that fully describes the characteristics of services that are
deployed on a network.
Metadata is fundamental to achieving the loose coupling that is associated with an SOA.
WSDL is an XML format for describing (network) services as a set of endpoints that operate on
messages containing either document-oriented or procedure oriented information.
WSDL Features
WSDL definitions describe how to access a web service and what operations it will perform.
WSDL is an integral part of Universal Description, Discovery, and Integration (UDDI), an XML-
based worldwide business registry.
1. abstract definitions
2. Concrete descriptions.
The service interface is defined in a service description expressed in WSDL. The WSDL
specification defines:
What operations the service supports and the format of the messages that are sent and
received by the service.
How the service is accessed - that is, the binding maps the abstract interface onto a
concrete set of protocols.
Where the service is located. This is usually expressed as a URI (Universal Resource
Identifier).
Messages: Contains function parameters (inputs are separate from outputs) or document
descriptions.
PortTypes: Refers to message definitions in Messages section that describe function signatures
(operation name, input parameters, output parameters).
Concrete Descriptions
An Example
<message name="Simple.foo">
<part name="arg" type="xsd:int"/>
</message>
<message name="Simple.fooResponse">
<part name="result" type="xsd:int"/>
</message>
<portType name="SimplePortType">
<operation name="foo" parameterOrder="arg" >
<input message="wsdlns:Simple.foo"/>
<output message="wsdlns:Simple.fooResponse"/> </operation>
</portType>
WS-Policy
WS-Policy is a specification that allows web services to use XML to advertise their policies
(on security, quality of service, etc.) and for web service consumers to specify their policy
requirements.
WS-Policy represents a set of specifications that describe the capabilities and constraints of the
security (and other business) policies on intermediaries and end points (for example, required
security tokens, supported encryption algorithms, and privacy rules) and how to associate
policies with services and end points.
Discovery Services:
The transport, description, and messaging layer are fundamental to allowing Web services to
communicate in an interoperable way using messages.
However, to facilitate this, it is necessary to collect and store the important metadata that
describes these services.
The metadata must be in a form that is discoverable and searchable by users who are looking
for appropriate services they require to solve some particular business problem.
Also, such metadata aggregation and discovery services are a useful repository/registry in which
many different organizations might want to publish the services that they host, describe the
interfaces to their services, and enable domain-specific taxonomies of services.
It defines a metadata aggregation service and specifies protocols for querying and updating a
common repository of Web services information.
Public UDDIThese are UDDI repositories that can serve as a resource for Internet-based
Web services. An example of this is the UDDI Business Registry [UBR]hosted by a group of
vendors led by IBM, Microsoft, and SAPthat is replicated across multiple hosting
organizations.
Intra Enterprise UDDI- An enterprise has a private internal UDDI repository that provides
much more control over which service descriptions
are allowed to be placed there and used by application developers within that specific
enterprise.
Inter Enterprise UDDIThis basically scopes the content of the UDDI to services that are
shareable between specific business partners.
A business or a company can register three types of information into a UDDI registry. This
information is contained in three elements of UDDI.
1.White Pages,
3.Green Pages.
White Pages
White pages contain: Basic information about the company and its business. Basic contact
information including business name, address, contact phone number
Yellow Pages
Yellow pages contain more details about the company. They include descriptions of the kind of
electronic capabilities the company can offer to anyone who wants to do business with it.
Yellow pages uses commonly accepted industrial categorization schemes, industry codes,
product codes, business identification codes and the like to make it easier for companies to
search Green pages through the listings and find exactly what they want.
Green Pages
contains technical information about a web service. A green page allows someone to bind to a
Web service after it's been found. It includes:
The various interfaces ,The URL locations, Discovery information and similar data required to
find and run the Web service.
Quality of Service
This layer include security, reliability of message delivery, and support for transactions
(guaranteeing and agreeing on the outcome of a business application).
WS-Security:
Most distributed Web services rely on transport-level support for security functions (for
example, HTTPS).
Security relies on predefined trust relationships. Kerberos works because participants trust the
Kerberos Key Distribution Center. Public Key Infrastructure (PKI) works because participants
trust the root certificate authorities.
WS-Trust defines an extensible model for setting up and verifying trust relationships. The key
concept in WS-Trust is a Security Token Service (STS). An STS is a distinguished
Web service that issues, exchanges, and validates security tokens. WS Trust allows Web services
to set up and agree on which security servers they trust, and to rely on these servers.
Reliable Messaging:
WS-ReliableMessaging addresses Communication issues and defines protocols that enable Web
services to ensure reliable, interoperable exchange of messages with specified delivery
assurances.
In-order deliveryThe messages are delivered in the same order in which they were sent.
At least once deliveryEach message that is sent is delivered at least one time.
Transactions:
Business scenarios necessitates the development of applications that consist of multiple Web
services exchanging many messages.
An example might be a group of financial institutions setting up a financial offering that involves
insurance policies, annuities, checking accounts, and brokerage accounts
A coordinated orchestration of the outcome of the participating services that make up the
business application is essential so that a coherent outcome of the whole business application
can be agreed upon and guaranteed.
Start new tasks, the execution and disposition of which are coordinated with other tasks
Agree on the outcome of the computation. For example, does everyone agree that the
financial packages were set up?
An interfaceParticipating services can use the interface to inform them of an outcome that
all of the participants have agreed upon.
WS-AtomicTransaction defines a specific set of protocols that plug into WS-Coordination to
implement the traditional two-phase atomic ACID transaction protocols.
WS-BusinessActivity defines a specific set of protocols that plug into the WS-Coordination model
to provide such long-running, compensation- based transaction protocols.
For example, although WS-BPEL defines a transaction model for business processes, it is WS-
BusinessActivity that specifies the corresponding protocol rendering.
Service Components
A business process specifies the potential execution order of operations from a collection of
Web services, the data that is shared between these composed Web services, which partners
are involved, and how they are involved in the business process, joint exception handling for
collections of Web services, and so on.
Business Process Execution Language for Web services (WS-BPEL, often shortened to BPEL)
provides a language to specify business processes and process states and how they relate to
Web services.
Composeability:
The term composeable describes independent Web service specifications that you can readily
combine to develop much more powerful capabilities
Interoperability
The fundamental premise of Web services is that standardization, predicated on the promise of
easy interoperability, resolves many of the long-standing issues facing businesses
WS-I
WS-I [WSI] is an open industry organization that is chartered to promote Web services
interoperability across differing platforms, operating systems/middleware, programming
languages, and tools.
It works across the varied existing industry and standards organizations to respond to
customer needs by providing guidance and best practices to help develop Web service
solutions.
WS-I was formed specifically for the creation, promotion, and support of generic protocols for
interoperable exchange of messages between Web services.
Standards for web service composition Standards for web service composition
Service orchestration
Service choreography
The resources are acted upon by using a set of simple, well-defined operations
Elements
REST
URI
Search services
Dictionary services
<?xml version="1.0"?>
</p:Parts>
<?xml version="1.0"?>
<Part-ID>00345</Part-ID>
<Name>Widget-A</Name>
<Quantity>10</Quantity>
Client-Server: a pull-based interaction style(Client request data from servers as and when
needed).
Stateless: each request from client to server must contain all the information necessary to
understand the request, and cannot take advantage of any stored context on the server.
Named resources - the system is comprised of resources which are named using a URL.
1.Identify all the conceptual entities that we wish to expose as services. (Examples we saw
include resources such as : parts list, detailed part data, purchase order)
3. Categorize our resources according to whether clients can just receive a representation of
the resource (using an HTTP GET), or whether clients can modify (add to) the resource using
HTTP POST, PUT, and/or DELETE).
4. All resources accessible via HTTP GET should be side-effect free. That is, the resource should
just return a representation of the resource. Invoking the resource should not result in
modifying the resource.
5.Put hyperlinks within resource representations to enable clients to drill down for more
information, and/or to obtain related information.
6. Design to reveal data gradually. Don't reveal everything in a single response document.
Provide hyperlinks to obtain more details.
7. Specify the format of response data using a schema (DTD, W3C Schema, RelaxNG, or
Schematron). For those services that require a POST or PUT to it, also provide a schema to
specify the format of the response.
8. Describe how our services are to be invoked using either a WSDL document, or simply an
HTML document.
UNIT 2
XML(eXtensible Markup Language)
XML tags identify the data and are used to store and organize the data, rather than specifying
how to display it like HTML tags, which are used to display the data.
XML can be used to exchange the information between organizations and systems.
A web service is any service that is available over the Internet, uses a standardized XML
messaging system, and is not tied to any one operating system or programming language
XML Documents
Declartions
Elements
Attributes
Comments etc
XML Documents
XML Declaration: contains details that prepare an XML processor to parse the XML document. It
is optional, but when used, it must appear in first line of the XML document.
XML elements can be defined as building blocks of an XML. Elements can behave as containers
to hold text, elements, attributes, media objects or all of these.
An XML element is everything from (including) the element's start tag to (including) the
element's end tag.
<person gender="female">
<!-------Your comment----->
An XML document:
1.<article>
<author>Gerhard Weikum</author>
<text>
</section>
</text>
</article>
2.<article>
<author>Gerhard Weikum</author>
<text>
</section>
</text>
</article>
3. <article>
<author>Gerhard Weikum</author>
</section>
</text>
</article>
Element content is typically parsed character data (PCDATA), i.e., strings with special
characters, and/or nested elements (mixed content if both).
Each XML document has exactly one root element and forms a tree.
Elements may have attributes (in the start tag) that have a name and
Only one attribute with a given name per element (but an arbitrary number of subelements)
Attributes have no structure, simply strings (while elements can have subelements)
As a rule of thumb:
Example:
A well-formed document must adher to, among others, the following rules:
An element may not have two attributes with the same name.
Message: A collection of data fields sent or received together between software applications. A message
contains a header (which stores control information about the message) and a payload (the actual
content of message).
Messaging uses messages to communicate with different systems to perform some kind of
function
When developers decided to build a web service messaging system, XML was therefore a
natural choice.
XML Messaging
Message: A collection of data fields sent or received together between software applications. A message
contains a header (which stores control information about the message) and a payload (the actual
content of message).
Messaging uses messages to communicate with different systems to perform some kind of
function
When developers decided to build a web service messaging system, XML was therefore a
natural choice.
<?xml version="1.0"?>
<message>
<header>
<to>companyReceiver</to>
<from>companySender</from>
<type>saveInvoice</type>
</header>
<body>
<saveInvoice>
<invoicedate="01-20-2000" number="123">
<address country="US">
<name>John Smith</name>
<city>Mountain View</city>
<state>CA</state>
<zip>94041</zip>
</address>
<billTo country="US">
<name>Company A</name>
<city>Washington</city>
<state>DC</state>
<zip>20015</zip>
</billTo>
<items>
<item number="1">
<quantity>1</quantity>
<USPrice>2000.00</USPrice>
</item>
</items>
</invoice>
</saveInvoice>
</body>
</message>
XML-RPC:
What is XML-RPC?
XML-RPC is a remote procedure call protocol using XML as data format and HTTP as transport
protocol.
Advantages of XML-RPC:
XML-RPC is language and platform independent. XML-RPC libraries are available in Java and
other languages.
XML-RPC is not more than its name implies and thus is very simple and lean
1. XML - Formatting of the request and response and the arguments (wire protocol)
XML-RPC architecture
The client application accesses the server through a URL (= location where service resides).
The XML-RPC listener receives requests and passes these to the handler (= user defined class
servicing the request).
Diagram:
XML-RPC is a simple protocol that uses XML messages to perform RPCs. Requests are encoded in
XML and sent via HTTP POST. XML responses are embedded in the body of the HTTP response.
To gain a high-level understanding of XML-RPC, consider a simple weather service. The service
expects a zip code and returns the current temperature for the area. Here is a sample XML-RPC
request to the weather service (HTTP headers omitted):
<methodCall>
<params>
</params>
</methodCall>
The request consists of a simple methodCall element that specifies the method name and any
method parameters.
<methodResponse>
<params>
<param>
</param>
</params>
</methodResponse>
The response consists of a single methodResponse element that specifies the return value.
3. XML-RPC protocol
The XML body of the HTTP request contains a single method call (getStateName).
The method is called on a service name under which the method is available.
The URL does not need to be specified (service is indicated by the string before the dot in the
method name element).
3. XML-RPC protocol
The XML body of the HTTP request contains a single method call (getStateName).
The method is called on a service name under which the method is available.
The URL does not need to be specified (service is indicated by the string before the dot in the
method name element).
<methodCall>
<params>
3. XML-RPC protocol
The HTTP return code is always 200 OK, even in case of an XML-RPC fault (see below).
The response contains a single value (like a return argument of a local procedure call).
HTTP/1.1 200 OK
<?xml version="1.0"?>
<methodResponse>
<params>
<param>
<value>
<string>South
</value>
</param>
</params>
</methodResponse>
XML-RPC protocol
Even in case of an XML-RPC level failure the HTTP return code is 200 OK.
HTTP/1.1 200 OK
<fault>
<value>
<struct>
<member><name>faultCode</name><value><int>4</int></value></member>
<member><name>faultString</name>
</value>
</member>
</struct>
</value>
</fault>
XML-RPC protocol
Parameter types :
Base types:
Structs:
Structs contain elements (<member>) with a <name> and <value> element ("named" values). Structs
may be recursive (value in a struct may be a struct again).
<struct>
<member>
<name>lowerBound</name>
<value><i4>18</i4></value>
</member>
<member>
<name>upperBound</name>
<value><i4>139</i4></value>
</member>
</struct>
XML-RPC protocol
Parameter types :
Arrays:
An array contains a single <data> element that in turn contains an array of <value> elements. An
array differs from a struct in that its elements are simple values (without <name> element). Arrays
may be recursive (value in array may be an array or also a struct).
<array>
<data>
<value><i4>12</i4></value>
<value><string>Egypt</string></value>
<value><boolean>0</boolean></value>
<value><i4>-31</i4></value>
</data>
</array>
XML-RPC may be suited for simple applications or situations where clients implemented in
different technologies need to interact with a server with simple read-write operations where
a more complex middleware technology would be overkill.
XML-RPC is very simple so it can be implemented also for platforms without open source or
Data Model
A set of type for passing parameters, return values and faults (error messages)
Request Structure
Response Structure
<i4>27</i4>
<double>-1.1465</double>
<boolean>0</boolean>
</dateTime.iso8601>
base64 Binary defined as in <base64>SGVsbG8sIFdvcmxkIQ==
RFC2045
</base64>
Some examples:
<int>27</int>
<double>27.31415</double>
<boolean>1</boolean>
<string>Hello</string>
<dateTime.iso8601>20020125T02:20:04
</dateTime.iso8601>
<base64>SGVsbG8sIFdvcmxkIQ==</base64>
<value>
</value>
These basic types can be combined into two more complex types: Array and Struct
<value>
<array>
<data>
<value><string>This </string></value>
<value><string>is </string></value>
<value><string>an </string></value>
<value><string>array.</string></value>
</data>
</array>
</value>
<value>
<array>
<data>
<value><boolean>1</boolean></value>
<value><string>Chan Tai-Man </string></value>
<value><int> -91 </int></value>
<value><double>0.1234</double></value>
</data>
</array>
</value>
Arrays can be multi-dimensional
E.g.
value>
<array>
<data>
<value>
<array>
<data>
<value><int>10</int></value>
<value><int>20</int></value>
</data>
</array>
</value>
<value>
<array>
<data>
<value><int>30</int></value>
<value><int>40</int></value>
</data>
</array>
</value>
</data>
</array>
</value>
Struct contains unordered content, identified by name
Names are string, although it is not necessary to enclose them by string elements
Each struct element contains a list of member elements
Member elements each contain one name element and one value element
The order of members is not important
<value>
<struct>
<member>
<name>givenName</name>
<value><string>Tai-Man </string></value>
</member>
<member>
<name>familyName</name>
<value><string>Chan </string></value>
</member>
<member>
<name>age</name>
<value><int>27</int></value>
</member>
</struct>
</value>
.
<value>
<struct>
<member>
<name>Name</name>
<value><string>a</string></value>
</member>
<member>
<name>attributes</name>
<value><struct>
<member><name>href</name>
<value><string>http://ex.com</string></value>
</member>
<member><name>target</name>
<value><string>_top</string></value>
</member>
</struct></value>
</member>
</struct>
</value>
..
<?xml version=1.0?>
<methodCall>
<methodName>circleArea</methodName>
<params>
<param>
<value><double>2.42</double></value>
</param>
<param>
<value>
<array>
<data>
<value><int>10</int></value>
<value><int>20</int></value>
</data>
</array>
</value>
</param>
</params>
</methodCall>
If a request is successful the procedure was found, executed correctly, the result will be
returned thru the response to the client
Similar to request, a response needs to be attached to a HTTP header for surfing on the Web
<?xml version=1.0?>
<methodResponse>
<params>
<param>
<value><double>2.42</double></value>
</param>
</params>
</methodResponse>
<?xml version=1.0?>
<methodResponse>
<fault>
</fault>
</methodResponse>
..
<?xml version="1.0"?>
<methodResponse>
<fault>
<value>
<struct>
<member>
<name>code</name>
<value><int>26</int></value>
</member>
<member>
<name>message</name>
</value>
</member>
</struct>
</value>
</fault>
</methodResponse>
Web Services Protocol Stack
WSDL
It is an XML-based language for describing Web Services and how to access them.
It specifies the location of the service and the operations the services exposes.
A WSDL document is simply a set of definitions.
WSDL Structure
The UDDI:
The Universal Description, Discovery, and Integration specs define a way to publish and discover
information about Web services.
The UDDI business registration is an XML file that describes a business entity and its Web
services
UDDI Secority:
Not specified in detail, only general policies
Only authorized individuals can publish or change information in the registry
Changes or deletions can only be made by the originator of the information
Each instance of a registry can define its own user authentication mechanism
Proxy Model
In the first approach, application state was moved from inside the process address space to an
external process. In the second model, application data is moved into an external (persistent)
data store. In the third approach application logic as well as state is migrated outside the web
service infrastructure.
In this model, the web service worker process simply proxies application requests to a third-tier
computation..
The proxy is freed from almost all state maintenance concerns. The web service itself acts, in
this case, merely to provide interoperability. Some computation in the form of data and
protocol conversion can be done within the proxy itself as necessary.
Building web services
Web services are web apps that return data, not presentation. Since applications are typically
about accessing data, web services are poised to become the next evolutionary step in
distributed software development...
Why?
cross-platform application development
legacy system integration
Example
Looks like C#, but keep in mind these are web-based methods
client could be calling from any platform
parameters passed using XML
Building a client
Start by creating a client
WinForm, WebForm, console-based, anything you want!
for fun, let's use VB
End Sub
Here's what the call to Add() actually looks like