DZone
Database Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Database Zone > SOA Principles: An Example App

SOA Principles: An Example App

Giancarlo Frison user avatar by
Giancarlo Frison
·
May. 28, 12 · Database Zone · Interview
Like (0)
Save
Tweet
14.07K Views

Join the DZone community and get the full member experience.

Join For Free

soa describes a set of patterns for creating loosely coupled, standards-based business-aligned services that, because of the separation of concerns between description, implementation, and binding, provide a new level of flexibility.


service oriented architecture terminology has spread in recent years, at least among people who were involved in most of the information technology activities. the guidelines suggested by this methodology are granted as major factors to succeed in different distributable systems domains.
just as the definition is clear and easy to understand, so is its implementation into a real project, being intuitive, concise and elegant.

i have released an application demonstrating how soa’s principles can be applied into a small project making use of eip (enterprise integration pattern), ioc (inversion of control), and a building tool and scripting language such as groovy.

i analized a simple business case : an entertainment provider who wanted to dispatch rewards and bonuses to some of its customers, depending on customer service’s subscriptions.

the process sequence is simple:

it is required to provide an implementation of a rewardsservice. the service accepts as input a customer account number and a portfolio containing channels subscriptions. the customer status team is currently developing the eligibilityservice which accepts the account number as an input.


i set up an infrastructure to write acceptance tests for this first meaningful feature. this is what could be defined as a “walking skeleton,” a prototype with the essential aspect that it could be built, deployed and tested after being easily downloaded from github .

rewardservice is invoked by the client and it calls, in turn, the eligibility service which however, in this case is not  implemented. as many real scenarios expect external services, this proof-of-concept refers the eligibility service to a black-box, where only request/response interface is known.

the unit test simulates the eligibility service behaviors mocking the end-point through the camel testing framework. however, if you want to run the application on your local machine i set up , within a line of code, a faux eligibility service that merely returns a positive response:

def alwayseligible = {exchange -> if(exchange){exchange.getout().setbody('customer_eligible')}} as processor

the entry point is an http restful interface built upon the apache cxf, and is easily set up within few lines in the configuration . cxf is initialized by spring in this following way:

jaxrs.'server'(id:'restservice',address:'http://${http.host}:${http.port}') {jaxrs.'servicebeans'{ ref(bean:'rewardservice')} }

services are connected by apache camel. rewardservice contains only the reference of the esb context –  an instance of producertemplate . such solution allows a complete separation between the linking system and the business services. the camel context represents  the soa’s wiring, and is configured through a dsl as in the example below:

from('direct:rewards').to(eligibilityserviceendpoint)
SOA app

Published at DZone with permission of Giancarlo Frison, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • How to Design a CRUD Web Service for Inheritable Entity
  • Applying Kappa Architecture to Make Data Available Where It Matters
  • Pattern Matching for Switch
  • Why Performance Projects Fail

Comments

Database Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo