Unit V Service-Oriented Analysis
Unit V Service-Oriented Analysis
Service-Oriented Analysis
The process of determining how business automation requirements can be represented through
service-orientation is the domain of the service-oriented analysis.
– Group service operation candidates into logical contexts. These contexts represent
service candidates.
– Define preliminary service boundaries so that they do not overlap with any existing or
planned services.
– Ensure that the context of encapsulated logic is appropriate for its intended use
– The previous chapter, the chosen strategy will determine the layers of abstraction that
comprise the service layers of a solution environment.
– Other questions that should be answered prior to proceeding with the serviceoriented
analysis include:
• What outstanding work is needed to establish the required business model (s) and
ontology?
• Existing application logic that is already, to whatever extent, automating any of the
requirements identified in Step 1 needs to be identified. While a service-oriented analysis
will not determine how exactly Web services will encapsulate or replace legacy
application logic, it does assist us in scoping the potential systems affected.
• The details of how Web services relate to existing systems are ironed out in the
serviceoriented design phase. For now, this information will be used to help identify
application service candidates during the service modeling process described in Step 3.
• Operations: Transactions that represent single logical units of work (LUWs). Execution
of an operation will typically cause one or more persistent data records to be read,
written, or modified. SOA operations are directly comparable to object-oriented (OO)
methods. They have a specific, structured interface, and return structured responses. Just
as for methods, the execution of a specific operation might involve invocation of
additional operations.
• Business Processes: A long running set of actions or activities performed with specific
business goals in mind. Business processes typically encompass multiple service
invocations. Examples of business processes are: Initiate New Employee, Sell Products
or Services, and Fulfill Order.
Service-Oriented Design
• Service-oriented design is the process by which concrete physical service designs are derived
from logical service candidates and then assembled into abstract compositions that implement a
business process.
• How can physical service interface definitions be derived from the service candidates modeled
during the service-oriented analysis phase?
– To address these questions, the design process actually involves further analysis. This
time our focus is on environmental factors and design standards that will shape our
services.
– Industry standards are provided by standards organizations and are published in Web
services and XML specifications
– We first establish a parent process that begins with some preparatory work. This leads
to a series of iterative processes that govern the creation of different types of service
designs and, ultimately, the design of the overall solution workflow
Step 1: Compose SOA
• Prerequisites
• Before we get into the details of the service-oriented design process, we should
make sure that we have a sufficient understanding of key parts of the languages
required to design services.
Service Modeling
– Candidate
- The primary goal of the service-oriented analysis stage is to figure out what it
is we need to later design and build in subsequent project phases. We are
producing abstract candidates that may or may not be realized as part of the
eventual concrete design.
– Service Candidates
• Process description
– Take the documented business process and break it down into a series of granular process
steps. It is important that a process's workflow logic be decomposed into the most
granular representation of processing steps, which may differ from the level of
granularity at which the process steps were originally documented.
Step 2: Identify business service operation candidates
– Some steps within a business process can be easily identified as not belonging
to the potential logic that should be encapsulated by a service candidate
– Examples include:
– Process steps performed by existing legacy logic for which service candidate
encapsulation is not an option.
– By filtering out these parts we are left with the processing steps most relevant
to our service modeling process.
– business rules
– conditional logic
– exception logic
– sequence logic
– These forms of orchestration logic may or may not be represented accurately by a step
description. In this case, only remove the condition and leave the action.
– Also some of the identified workflow logic likely will be dropped eventually. This is because
not all processing steps necessarily become service operations.
– Review the processing steps that remain and determine one or more logical contexts
with which these steps can be grouped. Each context represents a service candidate. The
contexts you end up with will depend on the types of business services you have chosen
to build
– For example, task-centric business services will require a context specific to the
process, while entity-centric business services will introduce the need to group processing
steps according to their relation to previously defined entities.
– To make our service candidates truly worthy of an SOA, we must take a closer look at the
underlying logic of each proposed service operation candidate.
– This step gives us a chance to make adjustments and apply key service-orientation principles.
– This is where the study we performed in the Native Web service support for service-orientation
principles section becomes useful.
– We identified the following four key principles as those not intrinsically provided through the
use of Web services:
• reusability
• autonomy
• statelessness
• Discoverability
– Of these four, only the first two are important to us at the service modeling stage.
Step 6: Identify candidate service compositions
– Identify a set of the most common scenarios that can take place within the boundaries of the
business process. For each scenario, follow the required processing steps as they exist now.
• It gives you a good idea as to how appropriate the grouping of your process steps is.
– Based on the results of the composition exercise in Step 6, revisit the grouping of your
business process steps and revise the organization of service operation candidates as
necessary. It is not unusual to consolidate or create new groups (service candidates) at
this point.
– By the end of Step 6, you will have created a business-centric view of your
services layer. This view could very well consist of both application and business
service candidates, but the focus so far has been on representing business process
logic.
– This next series of steps is optional and more suited for complex business
processes and larger service-oriented environments. It requires that you more
closely study the underlying processing requirements of all service candidates to
abstract any further technology-centric service candidates from this view that will
complete a preliminary application services layer.
– Specifically, what you need to determine is:
– Break down each application logic processing requirement into a series of steps. Be
explicit about how you label these steps so that they reference the function they are
performing. Ideally, you would not reference the business process step for which this
function is being identified.
– Group these processing steps according to a predefined context. With application service
candidates, the primary context is a logical relationship between operation candidates.
– Revisit the original scenarios you identified in Step 5 and run through them again.
Only, this time, incorporate the new application service candidates as well. This will
result in the mapping of elaborate activities that bring to life expanded service
compositions. Be sure to keep track of how business service candidates map to
underlying application service candidates during this exercise.
– Going through the motions of mapping the activity scenarios from Step 11 usually will
result in changes to the grouping and definition of application service operation
candidates. It will also likely point out any omissions in applicationlevel processing steps,
resulting in the addition of new service operation candidates and perhaps even new
service candidates.
• Optional Step: Keep an inventory of service candidates
– So far, this process has assumed that this is the first time you are modeling service
candidates. Ideally, when going through subsequent iterations of this process, you should
take existing service candidates into account before creating new ones. It can, however,
be tricky to look for reuse opportunities when modeling documents. This is because so
much of the verbiage used to describe service and service operation candidates gets lost
when this information is later translated into concrete service designs. As a result, this
step is considered optional. The service-oriented design processes also provide steps
dedicated to checking for reuse opportunities
WS-BPEL
WS-BPEL language is used to demonstrate how process logic can be described as part of
a concrete definition that can be implemented and executed via a compliant orchestration engine.
A brief history of BPEL4WS and WS-BPEL
The Business Process Execution Language for Web Services (BPEL4WS) was first
conceived in July, 2002, with the release of the BPEL4WS 1.0 specification, a joint effort by
IBM, Microsoft, and BEA. This document proposed an orchestration language inspired by
previous variations, such as IBM's Web Services Flow Language (WSFL) and Microsoft's
XLANG specification. Joined by other contributors from SAP and Siebel Systems, version 1.1 of
the BPEL4WS specification was released less than a year later, in May of 2003. This version
received more attention and vendor support, leading to a number of commercially available
BPEL4WS-compliant orchestration engines. Just prior to this release, the BPEL4WS
specification was submitted to an OASIS technical committee so that the specification could be
developed into an official, open standard.
Fig 5.1. A common WS-BPEL process definition structure.
The process element
The process is the root element of a WS-BPEL process definition. It is assigned a name
value using the name attribute and is used to establish the process definition-related namespaces.
A skeleton process definition.
<processname="TimesheetSubmissionProcess"
targetNamespace="http://www.xmltc.com/tls/process/" xmlns=
"http://schemas.xmlsoap.org/ws/2003/03/business-process/"
xmlns:bpl="http://www.xmltc.com/tls/process/"
xmlns:emp="http://www.xmltc.com/tls/employee/"
xmlns:inv="http://www.xmltc.com/tls/invoice/"
xmlns:tst="http://www.xmltc.com/tls/timesheet/"
xmlns:not="http://www.xmltc.com/tls/notification/">
<partnerLinks>
...
</partnerLinks>
<variables>
...
</variables>
<sequence>
...
</sequence>
...
</process>
The process construct contains a series of common child elements like partner-link, variables,
sequence etc.
The partnerLinks and partnerLink elements
A partnerLink element establishes the port type of the service (partner) that will be
participating during the execution of the business process. Partner services can act as a client to
the process, responsible for invoking the process service. Alternatively, partner services can be
invoked by the process service itself. The contents of a partnerLink element represent the
communication exchange between two partners the process service being one partner and another
service being the other. Depending on the nature of the communication, the role of the process
service will vary. For instance, a process service that is invoked by an external service may act in
the role of
"TimesheetSubmissionProcess." However, when this same process service invokes a different
service to have an invoice verified, it acts within a different role, perhaps "InvoiceClient." The
partnerLink element therefore contains the myRole and partnerRole attributes that establish the
service provider role of the process service and the partner service respectively. Put simply, the
myRole attribute is used when the process service is invoked by a partner client service, because
in this situation the process service acts as the service provider. The partnerRole attribute
identifies the partner service that the process service will be invoking (making the partner service
the service provider).
The partnerLinks construct containing one partnerLink element in which the process
service is invoked by an external client partner and four partnerLink elements that
identify partner services invoked by the process service.
<partnerLinks>
<partnerLink name="client" partnerLinkType="tns:TimesheetSubmissionType"
myRole="TimesheetSubmissionServiceProvider"/>
<partnerLinkname="Invoice" partnerLinkType="inv:InvoiceType"
partnerRole="InvoiceServiceProvider"/>
<partnerLink name="Timesheet" partnerLinkType="tst:TimesheetType"
partnerRole="TimesheetServiceProvider"/>
<partnerLink name="Employee" partnerLinkType="emp:EmployeeType"
partnerRole="EmployeeServiceProvider"/>
<partnerLink name="Notification" partnerLinkType="not:NotificationType"
partnerRole="NotificationServiceProvider"/>
</partnerLinks>
The partnerLinkType element
For each partner service involved in a process, partnerLinkType elements identify the
WSDL portType elements referenced by the partnerLink elements within the process definition.
Therefore, these constructs typically are embedded directly within the WSDL documents of
every partner service. The partnerLinkType construct contains one role element for each role the
service can play, as defined by the partnerLink myRole and partnerRole attributes. As a result, a
partnerLinkType will have either one or two child role elements.
A WSDL definitions construct containing a partnerLinkType construct. <definitions
name="Employee" targetNamespace="http://www.xmltc.com/tls/employee/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:plnk= "http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
...
>
...
<plnk:partnerLinkType name="EmployeeServiceType" xmlns=
"http://schemas.xmlsoap.org/ws/2003/05/partner-link/">
<plnk:role name="EmployeeServiceProvider">
<portType name="emp:EmployeeInterface"/>
</plnk:role>
</plnk:partnerLinkType>
...
</definitions>
The variables element
WS-BPEL process services commonly use the variables construct to store state
information related to the immediate workflow logic. Entire messages and data sets formatted as
XSD schema types can be placed into a variable and retrieved later during the course of the
process. The type of data that can be assigned to a variable element needs to be predefined using
one of the following three attributes: messageType, element, or type. The messageType attribute
allows for the variable to contain an entire WSDL-defined message, whereas the element
attribute simply refers to an XSD element construct. The type attribute can be used to just
represent an XSD simpleType, such as string or integer.
The variables construct hosting only some of the child variable elements used later by the
Timesheet Submission Process.
<variables>
<variable name="ClientSubmission" messageType="bpl:receiveSubmitMessage"/>
<variable
name="EmployeeHoursRequest"messageType="emp:getWeeklyHoursRequestMessage"/>
<variable name="EmployeeHoursResponse"
messageType="emp:getWeeklyHoursResponseMessage"/>
<variable name="EmployeeHistoryRequest"
messageType="emp:updateHistoryRequestMessage"/>
<variable name="EmployeeHistoryResponse"
messageType="emp:updateHistoryResponseMessage"/>
...
</variables>
Typically, a variable with the messageType attribute is defined for each input and output
message processed by the process definition. The value of this attribute is the message name
from the partner process definition.
The getVariableProperty and getVariableData functions
WS-BPEL provides built-in functions that allow information stored in or associated with
variables to be processed during the execution of a business process.
getVariableProperty(variable name, property name)
This function allows global property values to be retrieved from variables. It simply
accepts the variable and property names as input and returns the requested value.
getVariableData(variable name, part name, location path)
Because variables commonly are used to manage state information, this function is
required to provide other parts of the process logic access to this data. The getVariableData
function has a mandatory variable name parameter and two optional arguments that can be used
to specify a part of the variable data. In our examples we use the getVariableData function a
number of times to retrieve message data from variables.
Two getVariableData functions being used to retrieve specific pieces of data from different
variables.
getVariableData ('InvoiceHoursResponse', 'ResponseParameter')
getVariableData ('input','payload','/tns:TimesheetType/Hours/...')
The sequence element
The sequence construct allows you to organize a series of activities so that they are
executed in a predefined, sequential order. WS-BPEL provides numerous activities that can be
used to express the workflow logic within the process definition. The remaining element
descriptions in this section explain the fundamental set of activities used as part of our upcoming
case study examples.
A skeleton sequence construct containing only some of the many activity elements provided
by WS-BPEL.
<sequence>
<receive>
...
</receive>
<assign>
...
</assign>
<invoke>
...
</invoke>
<reply>
The invoke element
This element identifies the operation of a partner service that the process definition
intends to invoke during the course of its execution. The invoke element is equipped with five
common attributes, which further specify the details of the invocation.
invoke element attributes
Attribute Description
partnerLink This element names the partner service via its corresponding partnerLink.
portType The element used to identify the portType element of the partner service.
operation The partner service operation to which the process service will need to send
its request.
inputVariable The input message that will be used to communicate with the partner
service operation. Note that it is referred to as a variable because it is
referencing a WSBPEL variable element with a messageType attribute.
operation The process service operation that will be receiving the request.
variable The process definition variable construct in which the incoming request
message will be stored.
createInstance When this attribute is set to "yes," the receipt of this particular request may
be responsible for creating a new instance of the process.
The receive element used in the Timesheet Submission Process definition to indicate the
client partner service responsible for launching the process with the submission of a
timesheet document.
<receive name="receiveInput" partnerLink="client"
portType="tns:TimesheetSubmissionInterface" operation="Submit"
variable="ClientSubmission" createInstance="yes"/>
The reply element
Where there's a receive element, there's a reply element when a synchronous exchange is
being mapped out. The reply element is responsible for establishing the details of returning a
response message to the requesting client partner service. Because this element is associated with
the same partnerLink element as its corresponding receive element, it repeats a number of the
same attributes.
reply element attributes
Attribute Description
partnerLink The same partnerLink element established in the receive element.
portType The same portType element displayed in the receive element.
operation The same operation element from the receive element.
variable The process service variable element that holds the message that is
returned to the partner service.
messageExchange It is being proposed that this optional attribute be added by the WS-
BPEL 2.0 specification. It allows for the reply element to be
explicitly associated with a message activity capable of receiving a
message (such as the receive element).
A potential companion reply element to the previously displayed receive element. <reply
partnerLink="client" portType="tns:TimesheetSubmissionInterface" operation="Submit"
variable="TimesheetSubmissionResponse"/>
The switch, case, and otherwise elements
These three structured activity elements allow us to add conditional logic to our process
definition, similar to the familiar select case/case else constructs used in traditional programming
languages. The switch element establishes the scope of the conditional logic, wherein multiple
case constructs can be nested to check for various conditions using a condition attribute. When a
condition attribute resolves to "true," the activities defined within the corresponding case
construct are executed. The otherwise element can be added as a catch all at the end of the switch
construct. Should all preceding case conditions fail, the activities within the otherwise construct
are executed.
A skeleton case element wherein the condition attribute uses the getVariableData function
to compare the content of the EmployeeResponseMessage variable to a zero value.
<switch>
<case condition= "getVariableData('EmployeeResponseMessage','ResponseParameter')=0">
...
</case>
<otherwise>
...
</otherwise>
</switch>
The assign, copy, from, and to elements
This set of elements simply gives us the ability to copy values between process variables,
which allows us to pass around data throughout a process as information is received and
modified during the process execution.
Within this assign construct, the contents of the
TimesheetSubmissionFailedMessage variable are copied to two different message variables.
<assign>
<copy>
<from variable="TimesheetSubmissionFailedMessage"/>
<to variable="EmployeeNotificationMessage"/>
</copy>
<copy>
<from variable="TimesheetSubmissionFailedMessage"/>
<to variable="ManagerNotificationMessage"/>
</copy>
</assign>
.1.2.5.6. faultHandlers, catch, and catchAll elements
This construct can contain multiple catch elements, each of which provides activities that
perform exception handling for a specific type of error condition. Faults can be generated by the
receipt of a WSDL-defined fault message, or they can be explicitly triggered through the use of
the throw element. The faultHandlers construct can consist of (or end with) a catchAll element to
house default error handling activities.
The faultHandlers construct hosting catch and catchAll child constructs.
<faultHandlers>
<catch faultName="SomethingBadHappened" faultVariable="TimesheetFault">
...
</catch>
<catchAll>
...
</catchAll>
</faultHandlers>
Other WS-BPEL elements
The following table provides brief descriptions of other relevant parts of the WS-BPEL
language.
Quick reference table providing short descriptions for additional WS-BPEL elements.
Element Description
compensationHandler A WS-BPEL process definition can define a compensation
process that kicks in a series of activities when certain
conditions occur to justify a compensation. These activities are
kept in the compensationHandler construct.
correlationSets WS-BPEL uses this element to implement correlation, primarily
to associate messages with process instances. A message can
belong to multiple
empty This simple element allows you to state that no activity should occur
for a particular condition.
pick Similar to the eventHandlers element, this construct also can contain
child onMessage and onAlarm elements but is used more to respond to
external events for which process execution is suspended.
terminate This element effectively destroys the process instance. The WS-BPEL
2.0 specification proposes that this element be renamed exit.
while This useful element allows you to define a loop. As with the case
element, it contains a condition attribute that, as long as it continues
resolving to "true," will continue to execute the activities within the
while construct.
WS-COORDINATION
WS-Coordination, which can be used to realize some of the underlying mechanics for
WSBPEL orchestrations. Specifically, we describe some of the elements from the WS-
Coordination specification and look at how they are used to implement the supplementary
specifications that provide coordination protocols (WS-BusinessActivity and WS-
AtomicTransaction). In terms of the WSCoordination language and its two protocol documents,
what may be of interest to you is the actual CoordinationContext header that is inserted into
SOAP messages. You may encounter this header if you are monitoring messages or if you need
to perform custom development associated with the coordination context.
The CoordinationContext element
This parent construct contains a series of child elements that each house a specific part of
the context information being relayed by the header.
A skeleton CoordinationContext construct.
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsc="http://schemas.xmlsoap.org/ws/2002/08/wscoor"
xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility">
<Header>
<wsc:CoordinationContext>
<wsu:Identifier>
...
</wsu:Identifier>
<wsu:Expires>
...
</wsu:Expires>
<wsc:CoordinationType>
...
</wsc:CoordinationType>
<wsc:RegistrationService>
...
</wsc:RegistrationService>
</wsc:CoordinationContext>
</Header>
<Body>
...
</Body>
</Envelope>
The activation service returns this CoordinationContext header upon the creation of a new
activity. As described later, it is within the CoordinationType child construct that the activity
protocol (WS-BusinessActivity, WS-AtomicTransaction) is carried. Vendor-specific
implementations of WSCoordination can insert additional elements within the
CoordinationContext construct that represent values related to the execution environment. The
Identifier and Expires elements
These two elements originate from a utility schema used to provide reusable elements.
WSCoordination uses the Identifier element to associate a unique ID value with the current
activity. The Expires element sets an expiry date that establishes the extent of the activity's
possible lifespan.
Identifier and Expires elements containing values relating to the header. <Envelope
...
xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility">
...
<wsu:Identifier>
http://www.xmltc.com/ids/process/33342
</wsu:Identifier>
<wsu:Expires>
2008-07-30T24:00:00.000
</wsu:Expires>
...
</Envelope>
The CoordinationType element
This element is to explain about the WS-BusinessActivity and WS-AtomicTransaction
coordination types section.
Designating the WS-BusinessActivity coordination type
The specific protocol(s) that establishes the rules and constraints of the activity are
identified within the CoordinationType element. The URI values that are placed here are
predefined within the WS-BusinessActivity and WS-AtomicTransaction specifications. This first
example shows the CoordinationType element containing the WS-BusinessActivity coordination
type identifier. This would indicate that the activity for which the header is carrying context
information is a potentially long-running activity.
The CoordinationType element representing the WS-BusinessActivity protocol.
<wsc:CoordinationType>
http://schemas.xmlsoap.org/ws/2004/01/wsba
</wsc:CoordinationType>
Designating the WS-AtomicTransaction coordination type
In the next example, the CoordinationType element is assigned the WS-
AtomicTransaction coordination type identifier, which communicates the fact that the header's
context information is part of a short running transaction.
The CoordinationType element representing the WS-AtomicTransaction protocol.
<wsc:CoordinationType>
http://schemas.xmlsoap.org/ws/2003/09/wsat
</wsc:CoordinationType>
The RegistrationService element
The RegistrationService construct simply hosts the endpoint address of the registration service. It
uses the Address element also provided by the utility schema.
The RegistrationService element containing a URL pointing to the location of the
registration service.
<wsc:RegistrationService>
<wsu:Address>
http://www.xmltc.com/bpel/reg
</wsu:Address>
</wsc:RegistrationService>
WS-EXTENSIONS
The following five key WS-* extensions:
• WS-Addressing
• WS-ReliableMessaging
• WS-Policy Framework
• WS-MetadataExchange
• WS-Security Framework
WS-Addressing language basics
The most common implementations of WS-Addressing standardize the representation of
service endpoint locations and unique correlation values that tie together request and response
exchanges. However, additional features are available that allow for the design of highly self-
sufficient SOAP messages. Specifically, WS-Addressing includes extensions that support
endpoint references for pointing messages to specific instances of Web services and message
information (MI) headers that outfit messages with various types of transportation details. WS-
Addressing is a core WS-* extension providing features that can be used intrinsically or
alongside features offered by other WS-* specifications.
How WS-Addressing relates to the other WS-* specifications discussed in this chapter.
From The source endpoint element (of type EndpointReference) that conveys the
source endpoint address of the message.
FaultTo The fault endpoint element (also of type EndpointReference) that provides
the address to which a fault notification should be sent. FaultTo also
requires the use of MessageID.
To The destination element used to establish the endpoint address to which the
current message is being delivered.
A SOAP header with WS-Addressing message information header elements, three of which
contain Endpoint Reference elements.
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:app="http://www.xmltc.com/railco/...">
<Header>
<wsa:Action>
http://www.xmltc.com/tls/vp/submit
</wsa:Action>
<wsa:To>
http://www.xmltc.com/tls/vp/.
..
</wsa:To>
<wsa:From>
<wsa:Address>
http://www.xmltc.com/railco/ap1/...
</wsa:Address>
<wsa:ReferenceProperties>
<app:id>
unn:AFJK323llws
</app:id>
</wsa:ReferenceProperties>
<wsa:ReferenceParameters>
<app:sesno>
22322447
</app:sesno>
</wsa:ReferenceParameters>
</wsa:From>
<wsa:MessageID>
uuid:243234234-43gf433
</wsa:MessageID>
<wsa:ReplyTo>
<wsa:Address>
http://www.xmltc.com/railco/ap2/
</wsa:Address>
<wsa:ReferenceProperties>
<app:id>
unn:AFJK323llws
</app:id>
</wsa:ReferenceProperties>
<wsa:ReferenceParameters>
<app:sesno>
22322447
</app:sesno>
</wsa:ReferenceParameters>
</wsa:ReplyTo>
<wsa:FaultTo>
<wsa:Address>
http://www.xmltc.com/railco/ap-err/
</wsa:Address>
<wsa:ReferenceProperties>
<app:id>
unn:AFJK323llws
</app:id>
</wsa:ReferenceProperties>
<wsa:ReferenceParameters>
<app:sesno>
22322447
</app:sesno>
</wsa:ReferenceParameters>
</wsa:FaultTo>
</Header>
<Body>
...
</Body>
</Envelope>
WS-ReliableMessaging language basics
WS-ReliableMessaging introduces critical quality of service features for the guaranteed
delivery or failure notification of SOAP messages. It also positions itself as a fundamental WS-*
extension.
How WS-ReliableMessaging relates to the other WS-* specifications discussed in this
chapter.
When message exchanges are governed by a WS-ReliableMessaging-capable communications
framework, the concepts of sequences and acknowledgements become paramount to just about
every message transmission. Coming up are descriptions for the following key WS-
ReliableMessaging language elements:
• Sequence element
• MessageNumber element
• LastMessage element
• SequenceAcknowledgement element
• AcknowledgementRange element
• Nack element
• AckRequested element
Further supplementing these descriptions is a quick reference table containing brief descriptions
of the
following additional elements and assertions: SequenceRef, AcknowledgementInterval,
BaseRetransmissionInterval, InactivityTimeout, Expires, and SequenceCreation.
The Sequence, MessageNumber, and LastMessage elements
The Sequence construct resides in the SOAP message header to represent the location of
the current message in relation to the overall sequence of messages within which it is being
delivered. To accomplish this, the Sequence construct relies on a set of child elements. The
Identifier element is used to contain an ID value associated with the sequence itself, while the
MessageNumber element contains a number that is the position of the message within the overall
sequence order. Finally, the LastMessage element can be added to the Sequence construct to
communicate the fact that the current message is the final message of the sequence.
A Sequence construct with a LastMessage element, indicating that this is the final message
in the sequence. <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility"
xmlns:wsrm="http://schemas.xmlsoap.org/ws/2004/03/rm">
<Header>
<wsrm:Sequence>
<wsu:Identifier>
http://www.xmltc.com/railco/seq22231
</wsu:Identifier>
<wsrm:MessageNumber>
12
</wsrm:MessageNumber>
<wsrm:LastMessage/>
</wsrm:Sequence>
</Header>
<Body>
...
</Body>
</Envelope>
The SequenceAcknowledgement and AcknowledgementRange elements
Upon the arrival of one or more messages within a sequence, the recipient service may issue a
message containing the SequenceAcknowledgement header construct to communicate that the
original delivery was successful. This construct again uses the Identifier element to identify the
sequence, but it also needs an element to convey which of the messages within the sequence
were received and which were not. It accomplishes this through the use of the
AcknowledgementRange element, which contains the Upper and Lower attributes that indicate a
range of messages that were received. This range is based on the MessageNumber values of the
messages, which, when they are first generated, are incremented. So one
AcknowledgementRange element communicates each consecutive set of messages received.
Therefore, a message that is not received is not accounted for within the ranges specified in the
AcknowledgementRange elements.
A SequenceAcknowledgement construct indicating that 11 out of a sequence of 15
messages were received. <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility"
xmlns:wsrm="http://schemas.xmlsoap.org/ws/2004/03/rm">
<Header>
<wsrm:SequenceAcknowledgement>
<wsu:Identifier>
http://www.xmltc.com/tls/seq22231
</wsu:Identifier>
<wsrm:AcknowledgementRange Upper="4" Lower="1"/>
<wsrm:AcknowledgementRange Upper="8" Lower="6"/>
<wsrm:AcknowledgementRange Upper="12" Lower="11"/>
<wsrm:AcknowledgementRange Upper="15" Lower="14"/>
</wsrm:SequenceAcknowledgement>
</Header>
<Body>
...
</Body>
</Envelope>
The Nack element
Communicating the delivery failure of a message can, alternatively, be accomplished using the
Nack (negative acknowledgement) element. Instead of identifying which messages with
MessageNumber values were received, it shows which were not.
Example 5.22. A SequenceAcknowledgement construct containing a Nack element that
indicates that the fifth message was not received. <Envelope
xmlns="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility"
xmlns:wsrm="http://schemas.xmlsoap.org/ws/2004/03/rm">
<Header>
<wsrm:SequenceAcknowledgement>
<wsu:Identifier>
http://www.xmltc.com/tls/seq22231
</wsu:Identifier>
<wsrm:Nack>
5
</wsrm:Nack>
</wsrm:SequenceAcknowledgement>
</Header>
<Body>
...
</Body>
</Envelope>
The AckRequested element
RM destinations typically issue SOAP messages with SequenceAcknowledgement
headers at predefined times, such as upon the receipt of a message containing the LastMessage
element. However, an RM source service can request that the RM destination send out a
sequence acknowledgement message on demand by using the AckRequested header construct.
This construct simply contains a standard Identifier element to pinpoint the sequence for which it
is requesting an acknowledgement message. It also can include a MessageNumber element that
gives an indication as to which message receipt the RM source is most interested in.
The AckRequested header construct indicating that the RM source would like to receive a
sequence acknowledgement message.
<Envelope
xmlns="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/util
ity"
xmlns:wsrm="http://schemas.xmlsoap.org/ws/2004/03/r
m">
<Header>
<wsrm:AckRequested>
<wsu:Identifier>
http://www.xmltc.com/tls/seq22232
</wsu:Identifier>
</wsrm:AckRequested>
</Header>
<Body>
...
</Body>
</Envelope>
Other WS-ReliableMessaging elements
Additional WS-ReliableMessaging elements.
Element Description
SequenceRef This construct allows you to attach policy assertions to a
sequence, which introduces the ability to add various delivery
rules, such as those expressed in the delivery assurances.
The scope of the WS-MetadataExchange language is fairly small in comparison to other WS-*
specifications. The following two forms of metadata requests are standardized:
• GetMetadata
• Get
The descriptions that follow discuss the primary elements used to compose these two types of
request messages.
The GetMetadata element
This element can be placed on its own in the Body area of a SOAP message, or it can be
turned into a construct that hosts child Dialect and Identifier elements (explained next).
A SOAP request message containing the GetMetadata element in the Body construct. Note
the use of the WS-Addressing message information header elements in the SOAP header.
<Envelope xmlns="http://www.w3.org/2003/05/soap-envelope"
xmlns:wsa=
"http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex">
<Header> <wsa:Action>
http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadata/Reques
t
</wsa:Action>
<wsa:To>
http://www.xmltc.com/tls/ap
1/
</wsa:To>
<wsa:MessageID>
uuid:23492372938
</wsa:MessageID>
<wsa:ReplyTo>
<wsa:Address>
http://www.xmltc.com/railco/inv1/
</wsa:Address>
</wsa:ReplyTo>
</Header>
<Body>
<wsx:GetMetadata/>
...
</Body>
</Envelope>
The Dialect element
This element specifies the type and version of the metadata specification requested. The
use of the Dialect element guarantees that the metadata returned to the service requesting it will
be understood.
The Dialect element being used to indicate that the XSD schema requested should comply
to version 1.0 of the XML Schema Definition Language.
<Body>
<wsx:GetMetadata>
<wsx:Dialect>
http://www.w3.org/2001/XMLSchem
a </wsx:Dialect>
</wsx:GetMetadata>
</Body>
The Identifier element
While the Dialect element specifies the type of metadata being requested, this element
further narrows the criteria by asking for a specific part of the metadata.
The Identifier element added to specify the XSD schema's target namespace.
<Body>
<wsx:GetMetadata>
<wsx:Dialect>
http://www.w3.org/2001/XMLSchem
a
</wsx:Dialect> <wsx:Identifier>
http://www.www.xmltc.com/tls/schemas/ap1/schema
s
</wsx:Identifier>
</wsx:GetMetadata>
</Body>
The Metadata, MetadataSection, and MetadataReference elements
These three elements are used to organize the content of the message sent in response to a
GetMetadata request. The parent Metadata construct resides in the SOAP message Body area and
houses one or more child MetadataSection constructs that each represent a part of the returned
metadata. If the contents of the metadata document are returned, they are placed within the
MetadataSection construct. However, if only a pointer to the document is returned, its location is
found in the MetadataReference construct (further qualified by a regular WS-Addressing
Address element).
A GetMetadata response message returning the contents of an entire WSDL definition,
along with a pointer to the associated XSD schema.
<Envelope xmlns="http://www.w3.org/2003/05/soap-envelope"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex">
<Header>
<wsa:Action>
http://schemas.xmlsoap.org/ws/2004/09/
mex/GetMetadata/Response
</wsa:Action>
<wsa:RelatesTo>
23492372938
</wsa:RelatesTo>
<wsa:To>
http://www.xmltc.com/railco/inv
1
</wsa:To>
</Header>
<Body>
<wsx:Metadata>
<wsx:MetadataSection ...>
<wsdl:definitions>
... the entire WSDL definition ...
</wsdl:definitions>
</wsx:MetadataSection>
<wsx:MetadataSection ...>
<wsx:MetadataReference>
<wsa:Address>
http://www.www.xmltc.com/tls/ap1/schemas
</wsa:Address>
</wsx:MetadataReference>
</wsx:MetadataSection>
</wsx:Metadata>
</Body>
</Envelope>
The Get message
The response to a GetMetadata request message can include a MetadataReference
construct that contains the location of metadata documents not returned in this initial message.
To explicitly request one of these documents, a separate Get message is issued. While this
message does not contain a specific Get element, it does adhere to a standardized SOAP header
format, as follows.
A Get message SOAP header identified by the Action element value. The resource being
requested is targeted in the To element.
<Header>
<wsa:Action>
http://schemas.xmlsoap.org/ws/2004/09/mex/Get/Request
</wsa:Action>
<wsa:MessageID>
23492372938
</wsa:MessageID>
<wsa:ReplyTo>
<wsa:Address>
http://www.xmltc.com/railco/sub
1
</wsa:Address>
</wsa:ReplyTo> <wsa:To>
http://www.www.xmltc.com/tls/schemas/n
ot1
</wsa:To>
</Header>
WS-SECURITY
The WS-Security framework provides extensions that can be used to implement message-
level security measures. These protect message contents during transport and during processing
by service intermediaries. Additional extensions implement authentication and authorization
control, which protect service providers from malicious requestors. WS-Security is designed to
work with any of the WS-* specifications.
How WS-Security relates to the other WS-* specifications discussed in this chapter.
<wsse:UsernameToken>
<wsse:Username>
rco-3342
</wsse:Username>
<wsse:Password Type="wsse:PasswordDigest">
93292348347
</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</Header>
<Body>
...
</Body>
</Envelope>
Composing Security element contents (WS-Security)
As previously mentioned, the WS-Security specification positions the Security element as
a standardized container for header blocks originating from other security extensions. The
following example illustrates this by showing how a SAML block is located within the Security
construct. (As previously mentioned, single sign-on languages are beyond the scope of this book.
The SAML-specific elements shown in this example therefore are not explained.)
The WS-Security SOAP header hosting a SAML authorization assertion.
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Header>
<wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext">
<saml:Assertion xmlns:saml="..."...>
<saml:Conditions ...>
<saml:AuthorizationDecisionStatement Decision="Permit"
Resource="http://www.xmltc.com/tls/...">
<saml:Actions>
...
<saml:Action>
Execute
</saml:Action>
</saml:Actions>
...
</saml:AuthorizationDecisionStatement>
</wsse:Security>
</Header>
<Body>
...
</Body>
</Envelope>
The EncryptedData element (XML-Encryption)
This is the parent construct that hosts the encrypted portion of an XML document. If
located at the root of an XML document, the entire document contents are encrypted. The
EncryptedData element's Type attribute indicates what is included in the encrypted content. For
example, a value of http://www.w3.org/2001/04/xmlenc#Element indicates that the element and
its contents will be encrypted, whereas the value of http://www.w3.org/2001/04/xmlenc#Content
states that encryption will only be applied to the content within the opening and closing tags.
The CipherData, CipherValue, and CipherReference elements (XML-Encryption)
The CipherData construct is required and must contain either a CipherValue element
hosting the characters representing the encrypted text or a CipherReference element that provides
a pointer to the encrypted values. Following is an example of an XML document instance of this
schema. <InvoiceType>
<Number>
2322
</Number>
<Total>
$32,322.73
</Total>
<Date>
07.16.05
</Date>
</InvoiceType>
An XML document within a SOAP message containing an encrypted element.
<InvoiceType>
<Number>
2322
</Number>
<EncryptedData
xmlns="http://www.w3.org/2001/04/xmlenc#"
Type="http://www.w3.org/2001/04/xmlenc#Element">
<CipherData>
<CipherValue>
R5J7UUI78
</CipherValue>
</CipherData>
</EncryptedData>
<Date>
07.16.05
</Date>
</InvoiceType>
XML-Signature elements
A digital signature is a complex piece of information comprised of specific parts that each
represent an aspect of the document being signed. Therefore, numerous elements can be involved
when defining the construct that hosts the digital signature information. Table 17.5 provides brief
descriptions of some of the main elements.
XML-Signature elements
Element Description
CanonicalizationMethod This element identifies the type of "canonicalization algorithm"
used to detect and represent subtle variances in the document
content (such as the location of white space).
Signature The root element, housing all of the information for the digital
signature.
SignatureMethod The algorithm used to produce the digital signature. The digest and
canonicalization algorithms are taken into account when creating
the signature.
Three of the more significant specifications that pertain to SOA are listed here:
– Java 2 Platform Enterprise Edition Specification
• This important specification establishes the distributed J2EE component architecture and
provides foundation standards .
\