<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://training-course-material.com/index.php?action=history&amp;feed=atom&amp;title=SoaML_-_ServiceContract</id>
	<title>SoaML - ServiceContract - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://training-course-material.com/index.php?action=history&amp;feed=atom&amp;title=SoaML_-_ServiceContract"/>
	<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=SoaML_-_ServiceContract&amp;action=history"/>
	<updated>2026-04-15T01:22:06Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://training-course-material.com/index.php?title=SoaML_-_ServiceContract&amp;diff=29120&amp;oldid=prev</id>
		<title>Bernard Szlachta: /* Exercises */</title>
		<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=SoaML_-_ServiceContract&amp;diff=29120&amp;oldid=prev"/>
		<updated>2016-02-09T12:46:51Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Exercises&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Cat|SoaML|SoaML25}}&lt;br /&gt;
{{Cat|Enterprise Architecture|42}}&lt;br /&gt;
&lt;br /&gt;
* A ServiceContract defines:&lt;br /&gt;
** terms, conditions&lt;br /&gt;
** interfaces&lt;br /&gt;
** choreography&lt;br /&gt;
&lt;br /&gt;
* A ServiceContract is binding on all participating parties&lt;br /&gt;
* A Participant plays a role as the provider or user of services specified by ServiceContracts&lt;br /&gt;
* Each role is defined by an Interface or ServiceInterface &lt;br /&gt;
&lt;br /&gt;
* It defines the relationships between a set of roles defined by Interfaces and/or ServiceInterfaces.&lt;br /&gt;
&lt;br /&gt;
* It is the expectation of SoaML that:&lt;br /&gt;
** services may have bi-directional interactions &lt;br /&gt;
** communications may be long-lived and asynchronous&lt;br /&gt;
&lt;br /&gt;
 The simpler concept of a request-response function call or invocation &lt;br /&gt;
 is a degenerate case of a service, and can be expressed easily by UML &lt;br /&gt;
&lt;br /&gt;
* Participants can engage in a variety of contracts&lt;br /&gt;
&lt;br /&gt;
* Each time a ServiceContract is used in a ServicesArchitecture; there must also be a compliant port on a participant &lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
[[File:CourseOutlinePush ServiceContract.png|300px]]&lt;br /&gt;
&lt;br /&gt;
== Instructions ==&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039; Service Contract &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* A service contract is represented as a UML Collaboration and defines specific roles each participant plays in the service contract&lt;br /&gt;
* These roles have a name, an interface type that may be stereotyped as the «Provider» or «Consumer»&lt;br /&gt;
* The consumer is expected to start the service, calling on the provider to provide something of value to the consumer&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039; Choreography &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* The interaction diagram, above, illustrates the choreography of a service contract&lt;br /&gt;
* The interactions are synchronous but they can be be defined using signals, which makes this service contract asynchronous and document oriented, a mainstream SOA best practice&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039; provider : CourseOutlineTarget &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* Defines the role of the provider in the CourseOutlinePush service&lt;br /&gt;
* The type “CourseOutlineTarget” is the interface that a provider will implement on a port to provide this service (also could be a «ServiceInterface»).&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039; consumer: CourseOutlineSource &amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
*  The type of  is “CourseOutlineSource” is the interface that a consumer will implement on a port to consume this service (may be empty, indicating a one-way service)&lt;br /&gt;
 &lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039; «Provider» CourseOutlineTarget &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* Indicates all the operations and signals a providing participant may receive when enacting this service&lt;br /&gt;
* CourseOutlineSource uses the CourseOutlineTarget (the dashed line) – this shows that the CourseOutlineSource calls the CourseOutlineTarget (using signals or operations)&lt;br /&gt;
* In any bi-directional service the provider will respond to the consumers requests using the CourseOutlineTarget interface&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039; «Consumer» CourseOutlineSource &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* Indicates all of the operations and signals a consuming participant will receive when enacting the service with the provider&lt;br /&gt;
* In simple unidirectional services, the consumer interface may be missing or empty.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Use of the service contract to define participants ===&lt;br /&gt;
* the case described is marked red in the diagram&lt;br /&gt;
* nobleprog.co.uk participant has CourseOutlineSource, it provides this interface&lt;br /&gt;
* nobleprog.us participant has CourseOutlineTarget, it provides this interface&lt;br /&gt;
&lt;br /&gt;
* The interfaces are described by the “CourseOutlinePush” behavior and so must abide by that choreography when offering that service&lt;br /&gt;
&lt;br /&gt;
* These ports have “conjugate” provided and required interfaces and are therefore compatible and these ports can be connected to enact the service&lt;br /&gt;
&lt;br /&gt;
* Showing the port name, type and interfaces is a bit overkill, so we usually only show the port type on diagrams&lt;br /&gt;
&lt;br /&gt;
 The service contract is a binding contract with respect to the participants.&lt;br /&gt;
 By using the interfaces of a service contract (CourseOutlineSource and CourseOutlineTarget)&lt;br /&gt;
 the participants are bound to that contract when interacting via that port.&lt;br /&gt;
 The interfaces represent the type of each bound party.&lt;br /&gt;
 &lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;This is an extension to the UML concept of a collaboration which is not binding &lt;br /&gt;
 without an explicit collaboration use&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
=== Use of «Service» and «Request» (Alternative) ===&lt;br /&gt;
* The case described here is marked green in the diagram above&lt;br /&gt;
* An alternative way of using the same interfaces involves the use of «Service» and «Request» ports&lt;br /&gt;
* When using this style of modeling the participant’s ports only the Provider interface is used&lt;br /&gt;
* The provider interface is used as the type of a «ServicePoint» and also as the type of a RequestPoint. &lt;br /&gt;
* Request is a “conjugate” port, that is it inverts the required and provided interfaces.&lt;br /&gt;
* Use of Request and «Service» is useful when there is a simple one-way interface (that is the consumer does not have an interface) or for a binary service contract (as shown).&lt;br /&gt;
* Note that in the above diagram the type of the nobleprog.co.uk  service port is “~CourseOutlineTarget” – this is the CourseOutlineTarget interface, the same as is used in the nobleprog.us port&lt;br /&gt;
* The tilde (“~”) indicates that this is the conjugate type&lt;br /&gt;
* Since the conjugated type has been used (as indicated by the Request stereotype) the interfaces that are provided and required by a port are exactly the same&lt;br /&gt;
* The use of the consumer’s interface or Request yields exactly the same result – it is the modeler’s option which way to use the service contract&lt;br /&gt;
* For service contracts with more than two participants the Request method does not work as well.&lt;br /&gt;
&lt;br /&gt;
== Exercises ==&lt;br /&gt;
# Design the same as in the previous exercise (ServiceInterface), but using ServiceContract&lt;br /&gt;
:[[File:ClipCapIt-160209-115107.PNG|10px]]&lt;/div&gt;</summary>
		<author><name>Bernard Szlachta</name></author>
	</entry>
</feed>