锘??xml version="1.0" encoding="utf-8" standalone="yes"?> 杞歡涓氫粠鏈鍒濈殑闈㈠悜榪囩▼銆侀潰鍚戝璞★紝鍒板悗鏉ョ殑闈㈠悜緇勪歡銆侀潰鍚戦泦鎴愶紝鐩村埌鐜板湪鐨勯潰鍚戞湇鍔★紝璧拌繃浜嗕竴鏉¤灪鏃嬩笂鍗囩殑鏇茬嚎銆?br />鍏跺疄錛岃嚜浠庝笂涓栫邯70騫翠唬鎻愬嚭鈥滆蔣浠跺嵄鏈衡濓紝璇炵敓杞歡宸ョ▼瀛︾浠ユ潵錛屼負浜嗗交搴曟憜鑴辮蔣浠剁郴緇熷紑鍙戞償娼紝鎴戜滑涓鐩翠篃娌℃湁鏀懼純鍔姏銆?br />SOA鐨勫畾涔?br />SOA錛岄潰鍚戞湇鍔$殑鏋舵瀯鏄竴涓粍浠舵ā鍨嬶紝瀹冨皢搴旂敤紼嬪簭鐨勪笉鍚屽姛鑳藉崟鍏?---鏈嶅姟(service)錛岄氳繃鏈嶅姟闂村畾涔夎壇濂界殑鎺ュ彛鍜屽綰?contract)鑱旂郴璧鋒潵銆傛帴鍙i噰鐢ㄤ腑绔嬬殑鏂瑰紡瀹氫箟錛岀嫭绔嬩簬鍏蜂綋瀹炵幇鏈嶅姟鐨勭‖浠跺鉤鍙般佹搷浣滅郴緇熷拰緙栫▼璇█錛屼嬌寰楁瀯寤哄湪榪欐牱鐨勭郴緇熶腑鐨勬湇鍔″彲浠ヤ嬌鐢ㄧ粺涓鍜屾爣鍑嗙殑鏂瑰紡榪涜閫氫俊銆?br />榪欑鍏鋒湁涓珛鐨勬帴鍙e畾涔?娌℃湁寮哄埗緇戝畾鍒扮壒瀹氱殑瀹炵幇涓?鐨勭壒寰佺О涓烘湇鍔′箣闂寸殑鏉捐﹀悎
鏈嶅姟鏄暣涓猄OA瀹炵幇鐨勬牳蹇?#xB;
SOA鐨勪竴浜涢噸瑕佺壒寰?br />聽聽聽聽聽聽聽聽聽聽 鏈嶅姟鐨勯噸鐢?reuse)銆傛湇鍔$殑鍙噸鐢ㄦц璁℃樉钁楀湴闄嶄綆浜嗘垚鏈備負浜嗗疄鐜板彲閲嶇敤鎬э紝鏈嶅姟鍙伐浣滃湪鐗瑰畾澶勭悊榪囩▼鐨勪笂涓嬫枃(context)涓紝鐙珛浜庡簳灞傚疄鐜板拰瀹㈡埛闇姹傜殑鍙樻洿銆?/p>
SOA鐨勪竴浜涢噸瑕佺壒寰?br />聽聽聽聽聽聽聽聽聽聽聽 鏈嶅姟鐨勪簰鎿嶄綔銆備簰鎿嶄綔騫朵笉鏄竴涓柊姒傚康銆傚湪CORBA銆丏COM銆乄eb Service涓氨宸茬粡閲囩敤浜掓搷浣滄妧鏈簡銆傚湪SOA涓紝閫氳繃鏈嶅姟涔嬮棿鏃㈠畾鐨勯氫俊鍗忚榪涜浜掓搷浣溿備富瑕佹湁鍚屾鍜屽紓姝ヤ袱縐嶉氫俊鏈哄埗銆係OA鎻愪緵鏈嶅姟鐨勪簰鎿嶄綔鐗規ф洿鍒╀簬鍏跺湪澶氫釜鍦哄悎琚噸鐢ㄣ?/p>
SOA鐨勪竴浜涢噸瑕佺壒寰?br />聽聽聽聽聽聽聽聽聽聽 鏈嶅姟鏄嚜娌葷殑(Autonomous)鍔熻兘瀹炰綋銆傛湇鍔℃槸鐢辯粍浠剁粍鎴愮殑緇勫悎妯″潡錛屾槸鑷寘鍚拰妯″潡鍖栫殑銆?/p>
SOA鐨勪竴浜涢噸瑕佺壒寰?br />聽聽聽聽聽聽聽聽聽聽 SOA闈炲父寮鴻皟鏋舵瀯涓彁渚涙湇鍔$殑鍔熻兘瀹炰綋鐨勫畬鍏ㄧ嫭绔嬭嚜涓葷殑鑳藉姏銆備紶緇熺殑緇勪歡鎶鏈紝閮介渶瑕佹湁涓涓涓?Host鎴栬匰erver)鏉ュ瓨鏀懼拰綆$悊榪欎簺鍔熻兘瀹炰綋;褰撹繖浜涘涓昏繍琛岀粨鏉熸椂榪欎簺緇勪歡鐨勫鍛戒篃闅忎箣緇撴潫銆傝繖鏍峰綋瀹夸富鏈韓鎴栬呭叾瀹冨姛鑳介儴鍒嗗嚭鐜伴棶棰樼殑鏃跺欙紝鍦ㄨ瀹夸富涓婅繍琛岀殑鍏跺畠搴旂敤鏈嶅姟灝變細鍙楀埌褰卞搷銆?br />SOA鐨勪竴浜涢噸瑕佺壒寰?br />聽聽聽聽聽聽聽聽聽聽 SOA鏋舵瀯涓潪甯稿己璋冨疄浣撹嚜鎴戠鐞嗗拰鎭㈠鑳藉姏銆傚父瑙佺殑鐢ㄦ潵榪涜鑷垜鎭㈠鐨勬妧鏈紝姣斿浜嬪姟澶勭悊錛屾秷鎭槦鍒楃瓑鍦⊿OA涓兘璧峰埌鑷沖叧閲嶈鐨勪綔鐢ㄣ?br />SOA鐨勪竴浜涢噸瑕佺壒寰?br />聽聽聽聽聽聽聽聽聽聽 鏈嶅姟涔嬮棿鐨勬澗鑰﹀悎搴︺傛湇鍔¤姹傝呭埌鏈嶅姟鎻愪緵鑰呯殑緇戝畾涓庢湇鍔′箣闂村簲璇ユ槸鏉捐﹀悎鐨勩傝繖灝辨剰鍛崇潃錛屾湇鍔¤姹傝呬笉鐭ラ亾鎻愪緵鑰呭疄鐜扮殑鎶鏈粏鑺傦紝姣斿紼嬪簭璁捐璇█銆侀儴緗插鉤鍙幫紝絳夌瓑銆傛湇鍔¤姹傝呭線寰閫氳繃娑堟伅璋冪敤鎿嶄綔錛岃姹傛秷鎭拰鍝嶅簲錛岃屼笉鏄氳繃浣跨敤 API 鍜屾枃浠舵牸寮忋?br />SOA鐨勪竴浜涢噸瑕佺壒寰?br />聽聽聽聽聽聽聽聽聽聽 鏉捐﹀悎浣夸細璇濅竴绔殑杞歡鍙互鍦ㄤ笉褰卞搷鍙︿竴绔殑鎯呭喌涓嬪彂鐢熸敼鍙橈紝鍓嶆彁鏄秷鎭ā寮忎繚鎸佷笉鍙樸傚湪涓涓瀬绔殑鎯呭喌涓嬶紝鏈嶅姟鎻愪緵鑰呭彲浠ュ皢浠ュ墠鍩轟簬閬楃暀浠g爜鐨勫疄鐜板畬鍏ㄧ敤鍩轟簬 Java 璇█鐨勬柊浠g爜鍙栦唬錛屽悓鏃跺張涓嶅鏈嶅姟璇鋒眰鑰呴犳垚浠諱綍褰卞搷銆傝繖縐嶆儏鍐墊槸鐪熷疄鐨勶紝鍙鏂頒唬鐮佹敮鎸佺浉鍚岀殑閫氫俊鍗忚銆?br />SOA鐨勪竴浜涢噸瑕佺壒寰?br />聽聽聽聽聽聽聽聽 鏈嶅姟鏄綅緗忔槑鐨勩傛湇鍔℃槸閽堝涓氬姟闇姹傝璁$殑錛岄渶瑕佸弽搴旈渶姹傜殑鍙樺寲錛屽嵆鎵璋撴晱鎹瘋璁°傝鎯崇湡姝e疄鐜頒笟鍔′笌鏈嶅姟鐨勫垎紱匯傚氨蹇呴』浣垮緱鏈嶅姟鐨勮璁″拰閮ㄧ講瀵圭敤鎴鋒潵璇存槸瀹屽叏閫忔槑鐨勩備篃灝辨槸璇達紝鐢ㄦ埛瀹屽叏涓嶅繀鐭ラ亾鍝嶅簲鑷繁闇姹傜殑鏈嶅姟鐨勪綅緗紝鐢氳嚦涓嶅繀鐭ラ亾鍏蜂綋鏄摢涓湇鍔″弬涓庝簡鍝嶅簲銆?br />鎶借薄綰у埆1錛氭搷浣?br />聽聽聽聽聽聽聽聽聽聽 浠h〃鍗曚釜閫昏緫宸ヤ綔鍗曞厓鐨勪簨鍔°傛墽琛屾搷浣滈氬父浼氬鑷磋銆佸啓鎴栦慨鏀逛竴涓垨澶氫釜鎸佷箙鎬ф暟鎹係OA 鎿嶄綔鍙互鐩存帴涓庨潰鍚戝璞$殑鏂規硶鐩告瘮銆傚畠浠兘鏈夌壒瀹氱殑緇撴瀯鍖栨帴鍙o紝騫朵笖榪斿洖緇撴瀯鍖栫殑鍝嶅簲銆傚畬鍏ㄥ悓鏂規硶涓鏍鳳紝鐗瑰畾鎿嶄綔鐨勬墽琛屽彲鑳芥秹鍙婅皟鐢ㄩ檮鍔犵殑鎿嶄綔銆?br />鎶借薄綰у埆2錛氭湇鍔?br />聽聽聽聽聽聽聽聽聽聽 浠h〃鎿嶄綔鐨勯昏緫鍒嗙粍銆傛湇鍔″彲浠ュ垎灞傦紝浠ラ檷浣庤﹀悎搴﹀拰澶嶆潅鎬с備竴涓湇鍔$殑綺掑害澶у皬涔熶笌緋葷粺鐨勬ц兘鎭伅鐩稿叧銆傜矑搴﹀お灝忥紝浼氬鍔犳湇鍔¢棿浜掓搷浣滈氳鐨勫紑閿;綺掑害澶ぇ錛屽張浼氬獎鍝嶆湇鍔¢潰瀵歸渶姹傚彉鍖栫殑鏁忔嵎鎬с?br />鎶借薄綰у埆3錛氫笟鍔℃祦紼?br />聽聽聽聽聽聽聽聽聽聽 涓哄疄鐜扮壒瀹氫笟鍔$洰鏍囪屾墽琛岀殑涓緇勯暱鏈熻繍琛岀殑鍔ㄤ綔鎴栨椿鍔ㄣ備笟鍔℃祦紼嬮氬父鍖呮嫭澶氫釜涓氬姟璋冪敤銆?br />涓氬姟嫻佺▼
闈㈠悜鏈嶅姟鐨勬灦鏋?/p>
杞歡緋葷粺鏋舵瀯
SOA涓嶆槸涓縐嶈璦錛屼篃涓嶆槸涓縐嶅叿浣撶殑鎶鏈紝鏇翠笉鏄竴縐嶄駭鍝侊紝鑰屾槸涓縐嶈蔣浠剁郴緇熸灦鏋勶紝瀹冨皾璇曠粰鍑哄湪鐗瑰畾鐜涓嬫帹鑽愰噰鐢ㄧ殑涓縐嶆灦鏋勩?br />浠庤繖涓搴︿笂鏉ヨ錛屽畠鍏跺疄鏇村儚涓縐嶆灦鏋勬ā寮?Pattern)錛屾槸涓縐嶇悊蹇墊灦鏋勶紝鏄漢浠潰鍚戝簲鐢ㄦ湇鍔$殑瑙e喅鏂規妗嗘灦銆?/p>
銆聽聽聽聽聽聽 鏈嶅姟鏄竴涓嚜鍖呭惈鐨勩佹棤鐘舵佺殑瀹炰綋錛屽彲浠ョ敱澶氫釜緇勪歡緇勬垚銆傚畠閫氳繃浜嬪厛瀹氫箟鐨勭晫闈㈠搷搴旀湇鍔¤姹傘傚畠涔熷彲浠ユ墽琛岃濡傜紪杈戝拰澶勭悊浜嬪姟絳夌鏁fт換鍔°傛湇鍔℃湰韜茍涓嶄緷璧栦簬鍏朵粬鍑芥暟鍜岃繃紼嬬殑鐘舵併傜敤浠涔堟妧鏈疄鐜版湇鍔★紝騫朵笉鍦ㄥ叾瀹氫箟涓姞浠ラ檺鍒躲?/p>
聽聽聽聽聽聽聽聽聽聽 鏈嶅姟鎻愪緵鑰呮彁渚涚鍚堝綰︾殑鏈嶅姟錛屽茍灝嗗畠浠彂甯冨埌鏈嶅姟浠g悊銆?/p>
聽聽聽聽聽聽聽聽聽聽聽 鏈嶅姟璇鋒眰鑰呬篃鍙湇鍔′嬌鐢ㄨ咃紝瀹冨彂鐜板茍璋冪敤鍏朵粬鐨勮蔣浠舵湇鍔℃潵鎻愪緵鍟嗕笟瑙e喅鏂規銆備粠姒傚康涓婃潵璇達紝SOA 鏈川涓婃槸灝嗙綉緇溿佷紶杈撳崗璁拰瀹夊叏緇嗚妭鐣欑粰鐗瑰畾鐨勫疄鐜版潵澶勭悊銆傛湇鍔¤姹傝呴氬父縐頒負瀹㈡埛绔紝浣嗘槸錛屼篃鍙互鏄粓绔敤鎴峰簲鐢ㄧ▼搴忔垨鍒殑鏈嶅姟銆?/p>
SOA鏋舵瀯鐨勫熀鏈厓绱犳槸鏈嶅姟錛孲OA 鎸囧畾涓緇勫疄浣?鏈嶅姟鎻愪緵鑰呫佹湇鍔℃秷璐硅呫佹湇鍔℃敞鍐岃〃銆佹湇鍔℃潯嬈俱佹湇鍔′唬鐞嗗拰鏈嶅姟濂戠害)錛岃繖浜涘疄浣撹緇嗚鏄庝簡濡備綍鎻愪緵鍜屾秷璐規湇鍔°?br />閬靛驚 SOA 瑙傜偣鐨勭郴緇熷繀欏昏鏈夋湇鍔★紝榪欎簺鏈嶅姟鏄彲浜掓搷浣滅殑銆佺嫭绔嬬殑銆佹ā鍧楀寲鐨勩佷綅緗槑紜殑銆佹澗鑰﹀悎鐨勫茍涓斿彲浠ラ氳繃緗戠粶鏌ユ壘鍏跺湴鍧銆?/p>
聽聽聽聽聽聽聽聽聽聽 鏈嶅姟浠g悊鑰呬綔涓哄偍瀛樺簱銆佺數璇濋粍欏墊垨紲ㄦ嵁浜ゆ崲鎵錛屼駭鐢熺敱鏈嶅姟鎻愪緵鑰呭彂甯冪殑杞歡鎺ュ彛銆?/p>
聽聽聽聽聽聽聽聽聽 榪欎笁縐?SOA 鍙備笌鑰?鏈嶅姟鎻愪緵鑰呫佹湇鍔′唬鐞嗚呬互鍙婃湇鍔¤姹傝呴氳繃 3 涓熀鏈搷浣?鍙戝竷銆佹煡鎵俱佺粦瀹氱浉浜掍綔鐢ㄣ傛湇鍔℃彁渚涜呭悜鏈嶅姟浠g悊鑰呭彂甯冩湇鍔°傛湇鍔¤姹傝呴氳繃鏈嶅姟浠g悊鑰呮煡鎵炬墍闇鐨勬湇鍔★紝騫剁粦瀹氬埌榪欎簺鏈嶅姟涓娿傛湇鍔℃彁渚涜呭拰鏈嶅姟璇鋒眰鑰呬箣闂村彲浠ヤ氦浜掋?/p>
聽聽聽聽聽聽聽聽聽聽聽 鎵璋撴湇鍔$殑鏃犵姸鎬侊紝鏄寚鏈嶅姟涓嶄緷璧栦簬浠諱綍浜嬪厛璁懼畾鐨勬潯浠訛紝鏄姸鎬佹棤鍏崇殑(state-free)銆傚湪SOA鏋舵瀯涓紝涓涓湇鍔′笉浼氫緷璧栦簬鍏朵粬鏈嶅姟鐨勭姸鎬併?瀹冧滑浠庡鎴風鎺ュ彈鏈嶅姟璇鋒眰銆傚洜涓烘湇鍔℃槸鏃犵姸鎬佺殑錛屽畠浠彲浠ヨ緙栨帓(orchestrated)鍜屽簭鍒楀寲(sequenced)鎴愬涓簭鍒?(鏈夋椂榪橀噰鐢ㄦ祦姘寸嚎鏈哄埗) 錛屼互鎵ц鍟嗕笟閫昏緫銆傜紪鎺掓寚鐨勬槸搴忓垪鍖栨湇鍔″茍鎻愪緵鏁版嵁澶勭悊閫昏緫銆備絾涓嶅寘鎷暟鎹殑灞曠幇鍔熻兘銆?br />SOA鐨勪竴浜涢噸瑕佺壒寰?br />聽聽聽聽聽聽聽聽聽聽 鏈嶅姟鐨勫皝瑁?encapsulation)銆傚皢鏈嶅姟灝佽鎴愮敤浜庝笟鍔℃祦紼嬬殑鍙噸鐢ㄧ粍浠剁殑搴旂敤紼嬪簭鍑芥暟銆傚畠鎻愪緵淇℃伅鎴栫畝鍖栦笟鍔℃暟鎹粠涓涓湁鏁堢殑銆佷竴鑷寸殑鐘舵佸悜鍙︿竴涓姸鎬佺殑杞彉銆傚皝瑁呴殣钘忎簡澶嶆潅鎬с傛湇鍔$殑API淇濇寔涓嶅彉錛屼嬌寰楃敤鎴瘋繙紱誨叿浣撳疄鏂戒笂鐨勫彉鏇淬?/p>
聽聽聽聽聽聽聽聽聽聽 鍦⊿OA涓紝涓氬姟嫻佺▼鍖呮嫭渚濇嵁涓緇勪笟鍔¤鍒欐寜鐓ф湁搴忓簭鍒楁墽琛岀殑涓緋誨垪鎿嶄綔銆傛搷浣滅殑鎺掑簭銆侀夋嫨鍜屾墽琛岀О涓烘湇鍔℃垨嫻佺▼緙栨帓銆傚吀鍨嬬殑鎯呭喌鏄皟鐢ㄥ凡緙栨帓鏈嶅姟鏉ュ搷搴斾笟鍔′簨浠躲備粠寤烘ā鐨勮鐐規潵鐪嬶紝鎻忚堪璁捐鑹ソ鐨勬搷浣溿佹湇鍔″拰嫻佺▼鎶借薄鐨勭壒寰佷互鍙婄郴緇熷湴鏋勯犲畠浠槸閲嶈鐨勩?br />
]]>
By Samudra Gupta
Sun Corporation
Introduction
In recent times, more and more organizations are implementing IT systems across different departments. The challenge is to find a solution that is extendible, flexible and fits well with the existing legacy systems. Replacing legacy systems to cope with the new architecture is not only costly but also introduces risk of malfunctioning. In this context, the traditional software architectures proves ineffective in providing the right level of cost effective and extendible Information systems across the organization boundaries. Service Oriented Architecture (S0A) provides a relatively cheap and more cost-effective solution addressing these problems and challenges. Although, it is not a new concept, with the advent of recent platform-independent programs and platform-neutral data models, SOA needs some fresh attention. In this installment, we will examine the anatomy of a Service Oriented Architecture and develop an understanding of how to implement SOA in an architectural level.
Why do we need SOA?
One important factor in imbibing a new model of Software Architecture is the ever-changing business model. Modern day business constantly needs to adapt to new customer bases. The ability to quickly adapt to the new customer base and new business partners is the key to success. Sharing IT systems with other organizations is a new trend in the business. For example, businesses like online auctions are opening their systems to third party organization in an effort to better reach their customer base. In this context, Service Oriented Architecture offers benefit and cost-effectiveness to the business. The process of adapting to the changing business model is not an easy task. There are many legacy systems, which are difficult to make available to the new business partners. These legacy systems might need to change to support the new business functions and integrate to the newly developed IT systems or integrate to the IT systems of its partners'. The complexity of the whole thing is what makes it a constant challenge to organizations.
Imagine a government department has some legacy Sales Tax management system which interacts with the legacy Trader Management system. Suddenly, the government needs to incorporate a new Green House tax. Now the new Green House Tax system will also interact with the legacy Trader Information system and also affect the existing Sales Tax for the Traders who are paying Green House Tax, In essence, because of the introduction of the new Green House Tax system, both the legacy systems need to be readjusted to deal with the new type of Traders and Tax information. This is costly as all the existing legacy systems will have to be modified and will need to be re-tested.
This sort of complexity scenarios can be resolved by adopting SOA. Services are defined as a set of well-defined interfaces, which are generic in nature. Services also define a schema for the input to be supplied to the Service by its consumer. The inherent nature of SOA is that Services work with an extendible Schema and thereby can cope with various different types of entities that the Service is dealing with. For example, a Customer Management system works with a XML based data passed into it and it is capable of processing any type of Customer without needing to know the difference between a Corporate Customer and a Household Customer. This aspect of SOA resolves the above mentioned complexity scenario without having to change.
Essentially, Services operate as an independent entity. An Organizational IT system is composed of a collection of Services. Each of these Services can evolve and change in its own right.
Another example might be, a bank. Imagine that several areas of banking applications will deal with the current balance of an existing customer. More than often, the 鈥済et current balance鈥?functionality is repeated in various application softwares written within a banking environment. This gives rise to a redundant programming scenario. The focus should be towards finding this sort of common, reusable functionality and implement them as a service, so that all banking applications can reuse the service as and when necessary.
We have briefly discussed the case for SOA. We have seen that SOA is mostly driven by the business model of an organization. The real benefit lies in the reduced cost to fit into changing and reusable business model. Now let us try to define what do we mean by a 鈥淪ervice鈥?
What is a Service?
A Service is an implementation of a well-defined business functionality that operates independent of the state of any other Service defined within the system. Services have a well- defined set of interfaces and operate through a pre-defined contract between the client of the Service and the Service itself.
A Service can be of various nature. A Business service may mean 鈥済etAccountBalance鈥? A business Transaction Service may mean something like 鈥渕akeCreditCardPayment鈥? A system Service may offer some operations like 鈥渄eleteAFile鈥?
In Service Oriented Architecture, the system operates as a collection of services. Each Service may interact with various other Services to accomplish a certain task. The operation of one Service might be a combination of several low level functions. In that case, these low level functions are NOT considered Services.
How to Identify Services
Technically, you can make any piece of functionality as a Service, but doing so will make the organizational IT systems cluttered and complicated to maintain. The advantage is in keeping the Services as a set of well-organized functionalities. Services must represent a tangible Business concept. For example, getAccountBalance() is a tangible business process but convertStringToNumber() is not an identifiable business concept and therefore is not a candidate for a Service.
The process of identifying potential Services is by no means an easy task. At this stage, I have seen many organizations get carried away by the available technologies forgetting that the technology should not drive the Business. Although, identifying Services is a series of organization-wide analysis, certain analysis patterns can be applied to find out the potential services. Here are some things to consider when deciding.
Analyses a certain part of the organizational business process and decompose them into several smaller business process. For example, Order Processing System of an organization can be decomposed into smaller business processes such as checkInventory(), processPayment(), updateInventory() etc.
Identify if any of the smaller business processes are re- used or can potentially be reused in other organizational business process. For example, checkInventory() can also be used by the Stock Management application within the organization. The reusable business processes are strong candidates for operating as Services.
Draft the required inputs to these business processes and define what the specific outputs they must produce. Attention must be paid to keep these inputs and outputs generic so that the Service remains reusable and are capable of providing Service to changing business models. For example, processPayment() service at present might only accept check payment but should be flexible enough to support Card payment in order to support changing business needs. Hence, the input to the processPayment() Service must be defined in a generic fashion. We will discuss more about Service Specification in part 2 of this article.
Identify, if these Business processes are already implemented as an IT system within the organization. If yes, then analyses the Business critical factor for all the existing applications to identify which ones need to be converted to SOA. For example, if a clothes retailer no longer accepts refund/exchange of goods, we do not need to consider to look into Refund/Exchange application.
Identify, what Services operate together, what are the dependencies between various Services.
Find out, if the Services will be used only internally or will be opened to external consumers also. This will have impact on the definition of the Services.
Identify, whether the Services operate in a synchronous or asynchronous manner. What is the permissible response time for the Services?
These are guidelines from my experience in working in the industry with quite a few organizations, where we successfully provided SOA based solutions. By no means is this list complete and I do not believe that there can ever be a complete set of formulas for identifying the correct set and subset of Services to be implemented. It is always an ongoing process as new requirements keep on coming in. But the gist of the story is that one needs great attention to identify the sets of Services that are to be deployed within the organization.
Technology and Patience
I know I talk a lot about the background here, but, one thing I have learned from my mistakes is not to rush into technology. In order to be effective in our execution we must correctly identify the Business processes and the Business requirements. Only then can we make a decision on what technology will work best. Then, we draw a set of Service specifications. We measure the specifications against the infrastructural constraints of the organization in concern. A simple case may be that if most of the IT application in a specific organization is already written using Visual Basic, then we need to pause before we propose a Java based solution. Remember, any technology is capable of producing a Business solution and switching technology means extra costs, which may need to be justified. So please be patient until next part of this article, where we take a step towards the technology.
Conclusion
In the first part of this series, we have layed out a case for the Service Oriented Architecture, defined what Service actually means and discussed few guidelines about identifying Services. We have also warned about the danger in rushing to technology too early in the process of SOA implementation. In the next part of this article, we will talk about the Service specification and take a step towards available lava based technologies to implement Service Oriented Architecture.
Next month, we will talk about Service Specification and available technology and in the final part, we will discuss the most popular technology for SOA鈥擶eb Services.
聽
聽
聽
聽
Service Oriented Architecture - Part 2
By Samudra Gupta
Introduction
In part 1 of this article, we analyzed the need for Service Oriented Architecture (SOA) in today's ever changing business model. Experience shows that before we decide on a technology, careful thinking and analysis is required to arrive at the correct level of granularity and appropriate Service definitions. Development teams need to be focused on what we are trying to achieve and adapting any one technology does not guarantee success in achieving the goal. We outlined a few general guidelines in the analysis stage of the process and laid out a path for identifying Services. In part 2, we will concentrate more on the technical aspects of Service Oriented Architecture and finally will reach a framework for implementing Service Oriented Architecture.
The SOA objectives
Technically, the foremost concept to understand is what we are trying to achieve with SOA. At the very bottom, SOA relies on basic units of application software, which automates one or more pre-defined business processes. In a simplistic scenario, the goal is to make these basic application units accessible to the client and also for these basic application units to talk to each other in a technology-neutral manner. In a more complex scenario, the goal is to sustain these basic application components and just change the underlying technology for improved efficiency. For example, one organization might have a CustomerManagement?application component. The component offers some Services and the Insurance Department and the Marketing Department of the organization make use of the CustomerManagement. Now for improved efficiency, we must be able to migrate the CustomerManagement component to EJB without affecting the client of this component or event, we should be able to convert this component to a .NET component even though the client to this component is written using a different technology, Java per say.
Keeping these issues in mind, implementing SOA demands the following features:
Technology Independence: The Consumer of a Service component is completely independent of the technology of the Provider component and vice-versa.
Life-cycle Independence: Each of the Provider and Consumer Service components should be able to operate in a separate life- cycle.
Loose Coupling: The Service Consumer Component must define its specification independent of the Service Provider Component. The responsibility of aligning the two specifications is up to the Assembler component, which bridges the gap between two worlds.
Invokable interfaces: The Service interfaces must be invokable either locally or remotely. At the architecture level, we don鈥檛 really care how the interface is invoked.
Communication Protocol: A Service must be invokable by variety of protocol. The choice of protocol must not restrict the behavior of the Service. Binding to a specific protocol must take place at run-time/deployment-time, and not at the design or development time.
How to arrive at such solution
In the Part 1 of this series, we have defined Services as software application units that provide a distinct and atomic business process. Services do operate independent of the technology involved in the Consumer and the Service provider itself.
Although it is a new and novel concept to introduce the inter- operability of application units in a technology neutral way, the basic building of SOA relies on some of the proven methodologies such as Component Based Development. The Components do exist as the basic unit of the application performing a certain business operation itself or by collaborating with other components. What is unique to the SOA is how these components are invoked and also how the components interact with each other.
In my opinion, having a sound Component based design helps any organization to newly implement or even migrate towards SOA in a smooth transition. In the following sections, we will elaborate on the concepts of Component Based Development and how it can be used alongside Service Oriented Architecture (SOA). Often we use the term SOA and Web Service interchangeably, which is not strictly correct. Web Service is one implementation of SOA wherein SOA really means a set of technology, which enables us to develop business functions as Components which can be invoked and used in a technology independent fashion.
The Process
In the previous article of this series, we have outlined guidelines on identifying the reusable business processes across the organizations boundary. The outcome of this process can lead to the basic building blocks or Components that co-exist within an organization and perform one or more business operations.
Component Specification: In a technology neutral way like UML define the business functions. This must be technology independent. This just specifies what the interfaces are that the Component offers and what the Component dependencies are.
Interface Definition: Translation of the Functional Specification in a target platform language in a technology neutral way. For example, the interfaces can be elaborated using UML and translated into a programming language of choice such as Java.
Service Specification: Subscribing to 1..* functional interfaces. Services can collate multiple Component interfaces to provide a coarse-grained Service Definition. Again, this needs to be technology neutral.
Service Discovery and Registry: A mechanism for Registering Services to a registry. The Consumers use a Service Discovery mechanism and access the Services by looking up in the registry.
Technology binding: Consumer Components are inherently technology independent. We need to plug-in a technology binding mechanism to use a certain kind of interface exposed by the Service provider and its runtime instance technology. For example, we need to plug-in a technology layer into the Service Consumer to access a Service by using EJB or by using Web Service mechanism as is appropriate. We will elaborate on this later in this article.
The following small example will clear the clouds. Let us assume that in a company we are to write a Payroll Management System which manages the Employee payroll records and posts the pay- slips to their home addresses using the Address manager component. Also there is another Component which looks after the employee welfare and sends out a gift check on the anniversary or birthdays of employees.
The component specification of the above components can be shown as in Figure-1.
Figure-1 The Component Specification
Let us consider that we might want to offer a Service at a higher level called the EmployeeService which can subscribe to both the Payroll Management and Welfare Management interfaces. The Service Definition for the EmployeeService might look like the following in Figure-2.
Figure-2 The Service Specification
The interface definitions are still technology independent but can be translated in to a specific programming language such as Java. For example, the interface definition for the EmployeeService can look like the following in Java (Listing - 1). We have omitted the data type references from the diagram for simplicity
public interface IEmployeeManger {
聽聽 void sendPayslip(IEmployee employee, IDocument payslip)
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
聽聽聽聽聽聽 throws EmployeeNotFoundException,
ServiceUnavailableException;
聽
聽聽 void sendGiftCheck(IEmployee employee, IDocument check) throw
聽EmployeeNotFoundException,ServiceUnavailableException;
}
聽
Listing-1 the interface definition(there were two line breaks added to make it fit the page)
Note: The Exceptions listed above are very much application specific exceptions and avoid any technology specific exceptions.
The Glues
So far we have defined the EmployeeService and its interfaces. We have seen that this interface definition is totally technology neutral. However, at deployment time we may decide to one or more instances of this Service supporting different communication protocol. There is no restriction that the same Service cannot offer more than one invocation protocol. Rather, in different situations it is more appropriate to offer multiple protocol support to provide service to different Consumers.
So far we had the Consumer component and the Service Component being specified and implemented in isolation. But there must be something in the middle to glue these two together. We discuss the missing bits as follows:
Technology
In OO concept, the great thing about interface concept is that multiple implementations of the same interface can co-exist. Binding to any particular implementation can happen at run-time or compile-time. Dynamic binding at runtime offers greater flexibility to switch between implementations based on context. For example, an AddressManager Component can be invoked remotely using Web Service based on XML-SOAP protocol or also can be invoked as a Pure Java component or EJB when it is invoked locally.
It is a good design pattern to separate the technology layer form the actual business logic and business operations. The business operations can be implemented as a standard Java class. The technology layer is solely responsible to implement the technology logic and infrastructural service calls. For example, in EJB technology, the technology layer will consist of the EJBs, which will interact with the container to manage transactions etc. However, the actual business logic may be delegated to another standard Java class.
Service Discovery and Registry
When a Service interface is implemented using a specific technology, the Service needs to publish itself to a registry for the Consumers to lookup and use the Service. This is implemented as another separate layer called Service Access Layer. This layer is responsible for looking up Services using certain lookup mechanism. For an EJB, this layer might perform a JNDI lookup and for Web Service this layer might use a Web Service Registry lookup.
Where Happens the Mapping
So far we have said that the Service consumer and the Service provider specification are independent of each other. This also meant that the data represented in both these domains can also be different. So there needs to be a mechanism to align these two worlds. An ideal place for this mapping to happen is the Service Access Layer. This layer can receive the data object from the Service consumer and then use the Service provider Transfer object to map data. Also this layer can convert any Exceptions generated into an appropriate one that is understood and defined in the Service consumer specification.
Who Implements the Layers, the Responsibilities
We have seen that layering the application based on separation of concern is a good way to achieve the loose-coupling between the Service consumer and the Service provider. We have identified the layers within Components carrying out different roles and responsibilities. Looking at the full picture, we can thus assign the responsibilities to the Service consumer and to the Service Provider.
Figure 3 The overall picture
The Service Provider component is responsible for providing all the above mentioned layers. A mistake often made is to make the Service Access layer as part of the Consumer, which creates a tight-coupling between the Consumer and the Provider in terms of technology.
Conclusion
In this article, we have examined the technical aspects of the Service Oriented Architecture (SOA) and its root in Component Based Development (CBD). One of the biggest mistakes in the world of SOA is that they are identified with Web Services. But it is to be stressed that Web Service is one form of SOA. If we do not design our Components carefully, we will end-up with a solution which is tightly coupled with Web Services technology. In the future, it will then be a big change to move towards another technology such as Web Service. This sort of situation defies the very basic goal of SOA that we should be able to write Consumer and Provider Components irrespective of technology used in either of them.
In the next part of this series, we will develop a Web service example based on the Component concept discussed in there. Please feel free to discuss and let me know your ideas on this. Thanks.
Benoy Jose is a web developer with over six years of experience in J2EE and Microsoft technologies. He is a Sun Certified programmer and enjoys writing technical and non-technical articles for various magazines.