<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>Service-oriented Architecture (SOA) Archives - Francesco Lelli %</title> <atom:link href="https://francescolelli.info/tag/service-oriented-architecture-soa/feed/" rel="self" type="application/rss+xml" /><link>https://francescolelli.info/tag/service-oriented-architecture-soa/</link> <description>Information Management, Computer Science,  Economics, Finance and more</description> <lastBuildDate>Mon, 02 Nov 2020 19:32:41 +0000</lastBuildDate> <language>en-US</language> <sy:updatePeriod> hourly </sy:updatePeriod> <sy:updateFrequency> 1 </sy:updateFrequency> <generator>https://wordpress.org/?v=6.8.5</generator><image> <url>https://francescolelli.info/wp-content/uploads/2018/11/cropped-InstrumentElement-32x32.jpg</url><title>Service-oriented Architecture (SOA) Archives - Francesco Lelli %</title><link>https://francescolelli.info/tag/service-oriented-architecture-soa/</link> <width>32</width> <height>32</height> </image> <site
xmlns="com-wordpress:feed-additions:1">156264324</site> <item><title>A Service Encapsulation Example Using a Location Service</title><link>https://francescolelli.info/software-engineering/a-service-encapsulation-example-using-a-location-service/</link> <comments>https://francescolelli.info/software-engineering/a-service-encapsulation-example-using-a-location-service/#respond</comments> <dc:creator><![CDATA[Francesco Lelli]]></dc:creator> <pubDate>Mon, 02 Nov 2020 19:32:30 +0000</pubDate> <category><![CDATA[Big Data]]></category> <category><![CDATA[BPI]]></category> <category><![CDATA[Software Engineering]]></category> <category><![CDATA[interface]]></category> <category><![CDATA[Service]]></category> <category><![CDATA[Service Encapsulation]]></category> <category><![CDATA[Service-oriented Architecture (SOA)]]></category> <category><![CDATA[SOA]]></category> <category><![CDATA[software architecture]]></category> <guid
isPermaLink="false">https://francescolelli.info/?p=2176</guid><description><![CDATA[<p>In this post, I am going to present an example of Service Encapsulation using the case study of ACME Social and the University of Nowhere that is described in the linked article. Service Encapsulation is often used to hide the internal representation, or state, of an object from the outside. In this way, we can [&#8230;]</p><p>The post <a
href="https://francescolelli.info/software-engineering/a-service-encapsulation-example-using-a-location-service/">A Service Encapsulation Example Using a Location Service</a> appeared first on <a
href="https://francescolelli.info">Francesco Lelli</a>.</p> ]]></description> <content:encoded><![CDATA[<p>In this post, I am going to present an example of Service Encapsulation using the case study of <a
href="https://francescolelli.info/bpi/bpi-an-example-of-business-process-integration-big-data-flavor/" target="_blank" rel="noreferrer noopener">ACME Social and the University of Nowhere</a> that is described in the linked article.</p><p>Service Encapsulation is often used to hide the internal representation, or state, of an object from the outside. In this way, we can present to the outside world a cleaner, simpler, and more coherent view of the internal systems. Many services which were not initially planned for a Service Oriented Architecture (SOA) may get encapsulated or become a part of a SOA in this way.</p><p>In the example of ACME Social and University of Nowhere, both the parties agreed on exchanging information in order to improve the existing geolocation service of ACME Social. In particular, ACME Social would like to receive the following information from the University of Nowhere:</p><ul
class="wp-block-list"><li>Retrieve a list of unique IDs of the students</li><li>Retrieve the email addresse(s) of each student</li><li>Get the class that the student is supposed to follow</li><li>Retrieving the exact coordinates of the location of a given student according to the University of Nowhere.</li></ul><h3 class="wp-block-heading">Service Encapsulation: <strong>Can we design it as a stateless service?</strong></h3><p>Probably yes, even though students and their respective locations will change. From the point of view of the methods, we can expect that their behavior will not change over time. A possible UML diagram that describes the interface of the service could be as follows:</p><figure
class="wp-block-image size-large is-resized"><img
decoding="async" data-attachment-id="2177" data-permalink="https://francescolelli.info/software-engineering/a-service-encapsulation-example-using-a-location-service/attachment/university-of-nowhere-location-service/" data-orig-file="https://francescolelli.info/wp-content/uploads/2020/11/University-Of-Nowhere-Location-Service.jpg" data-orig-size="260,166" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;F. Lelli&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1604250551&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="University-Of-Nowhere-Location-Service" data-image-description="" data-image-caption="" data-medium-file="https://francescolelli.info/wp-content/uploads/2020/11/University-Of-Nowhere-Location-Service.jpg" data-large-file="https://francescolelli.info/wp-content/uploads/2020/11/University-Of-Nowhere-Location-Service.jpg" src="https://francescolelli.info/wp-content/uploads/2020/11/University-Of-Nowhere-Location-Service.jpg?8011c3&amp;8011c3" alt="" class="wp-image-2177" width="278" height="177"/></figure><p>The class represents all the functionalities requested by ACME Social in 4 methods.  It does not have attributes and this approach will keep the design simple. IDs, emails, as well as geocoordinates will be shared as Strings in order to use one of the basic types of a service.</p><p>In the case we will decide to implement a WS-I compliant service, we can assume that the calls of the methods can fail and may trigger exceptions on the service consumer&#8217;s side.</p><h3 class="wp-block-heading">What about the concerns of ACME Social and the documentation of the service?</h3><p>As the service represents the entry point of the systems of the university of Nowhere, we need to carefully balance the complexity of the interface that we need to design. On the one hand, it must be able to mask all the idiosyncrasies of the IT of the university in order to facilitate its consumption by ACME Social. On the other hand it must be able to deliver everything that is needed and agreed. The figure below shows how this interface sits at the intersection points of two different worlds with different needs and goals:</p><figure
class="wp-block-image size-large"><img
fetchpriority="high" decoding="async" width="982" height="567" data-attachment-id="2178" data-permalink="https://francescolelli.info/software-engineering/a-service-encapsulation-example-using-a-location-service/attachment/service-interface-and-service-implementation/" data-orig-file="https://francescolelli.info/wp-content/uploads/2020/11/Service-Interface-And-Service-Implementation.jpg" data-orig-size="982,567" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;F. Lelli&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1604256502&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Service-Interface-And-Service-Implementation" data-image-description="" data-image-caption="" data-medium-file="https://francescolelli.info/wp-content/uploads/2020/11/Service-Interface-And-Service-Implementation-300x173.jpg" data-large-file="https://francescolelli.info/wp-content/uploads/2020/11/Service-Interface-And-Service-Implementation.jpg" src="https://francescolelli.info/wp-content/uploads/2020/11/Service-Interface-And-Service-Implementation.jpg?8011c3&amp;8011c3" alt="A Service Encapsulation Example Using a Location Service " class="wp-image-2178" srcset="https://francescolelli.info/wp-content/uploads/2020/11/Service-Interface-And-Service-Implementation.jpg 982w, https://francescolelli.info/wp-content/uploads/2020/11/Service-Interface-And-Service-Implementation-300x173.jpg 300w, https://francescolelli.info/wp-content/uploads/2020/11/Service-Interface-And-Service-Implementation-768x443.jpg 768w, https://francescolelli.info/wp-content/uploads/2020/11/Service-Interface-And-Service-Implementation-600x346.jpg 600w" sizes="(max-width: 982px) 100vw, 982px" /></figure><p>ACME Social, i.e. the client of the service needs a clear answer to the following questions:</p><ul
class="wp-block-list"><li><em>What does the service do?</em> Answering to this question will require a proper documentation of the methods. The name may be intuitive, but some of its behavior may not. Therefore, it needs to be carefully documented.</li><li><em>How can we use the service? </em>The best way to answer this question is with an example of use. ACME social may use different languages so the example(s) need to be written in Java and Python (for example) and <a
href="https://francescolelli.info/programming/best-practices-on-how-to-write-comments-in-your-code/" target="_blank" rel="noreferrer noopener">the code must be well documented (see these best practices)</a>.</li><li><em>Where can we locate the service? </em>The URL of the service, together with the way to get the authorization of use, should be part of the documentation. In addition, the service should be part of an UDDI registry as well.</li></ul><p>ACME Social is not at all interested in:</p><ul
class="wp-block-list"><li>How to represent internally the request received from ACME social</li><li>How to implement the service</li><li>Where to host the server needed for running the service</li><li>How to publish the service in the Internet</li><li>How to keep it running</li></ul><p>These aspects are of fundamental importance for the University of Nowhere. However, these concerns should not be shared with the consumers of the service.</p><hr
/><p><em>A #service Encapsulation example using a location service. #servicedesign #programming</em><br
/><a
href='https://twitter.com/intent/tweet?url=https%3A%2F%2Ffrancescolelli.info%2Fsoftware-engineering%2Fa-service-encapsulation-example-using-a-location-service%2F&#038;text=A%20%23service%20Encapsulation%20example%20using%20a%20location%20service.%20%23servicedesign%20%23programming&#038;related' target='_blank' rel="noopener noreferrer" >Share on X</a><br
/><hr
/><p>The post <a
href="https://francescolelli.info/software-engineering/a-service-encapsulation-example-using-a-location-service/">A Service Encapsulation Example Using a Location Service</a> appeared first on <a
href="https://francescolelli.info">Francesco Lelli</a>.</p> ]]></content:encoded> <wfw:commentRss>https://francescolelli.info/software-engineering/a-service-encapsulation-example-using-a-location-service/feed/</wfw:commentRss> <slash:comments>0</slash:comments> <post-id
xmlns="com-wordpress:feed-additions:1">2176</post-id> </item> </channel> </rss>