ĐẠI HỌC THÁI NGUYÊN
KHOA CÔNG NGHỆ THÔNG TIN
KIẾN TRÚC HƯỚNG DỊCH VỤ & ỨNG DỤNG
(SERVICE-ORIENTED-ARCHITECTURE)
Mã số đề tài
Chủ nhiệm đề tài
Cố vấn khoa học
: S2010-08-21
: Nguyễn Thị Dung
: Th.s. Nguyễn Hồng Tân
Thái Nguyên 12/2010
MỤC LỤC
MỞ ĐẦU 1
CHƯƠNG 1: TỔNG QUAN VỀ KIẾN TRÚC HƯỚNG DỊCH VỤ (SERVICE-
ORIENTED-ARCHITECTURE) 2
CHƯƠNG 2: PHÁT TRIỂN PHẦN MỀM DỰA VÀO SOA 12
CHƯƠNG 3: KẾT QUẢ VÀ THẢO LUẬN 35
40
KẾT LUẬN 41
TÀI LIỆU THAM KHẢO 42
CHỮ KÝ XÁC NHẬN 44
MỞ ĐẦU
!"#$%&'(%)#%)*+!,&* %!/&0/&1%2"&34567&8/(
59%26:;<=%2&"&<>&!6=#&/.?%<0%#@!%!51%!/&0/!?.?/
#A%2&/1&:B%2&'(&!,%2(C/*D*E!F&"&G%2<=%2H!I%2&!J4%!K%2
!7!B%2!A9*1%2*L%4M#N%515".#95O5".&4)%P6&!>/ !=!/1&6A
51%%Q%2&B*>%!%A%K(35&!,%2 !Q4%!K%2!7!B%24%!*1%22,
%2RS<T%24567&U5V4,&35V%LWC/*D*+45%! !"#$% !Q*B
5X6Y!%24A9&"&6Z%*5Y%!R45:(A[&!!\ &"&!%! !0% !]%"%
496Y%!(/^!(.":;<=%2%!K%2!%! !0%&D:_%^6Z%*#$%H!(6`QA
#ab*(%24516Z%*45*N%*0/&"&%! !"#$%C
/.%!N%351!&?!7%%(.4 !0%55*(%2%2.&%2#@%N%
!G&9 8/"5G&6<RS%2%!R*(%26R\H!FH!Q%c%2H$5:A"&'(&"&5I
!a%! !"#$%!7%&DC2/.N%%!]%H!?%&!A!7!B%2&D*1 !G&9 c%2&(A
4<A:d/Z!7%&'(%!/&I%2%2!75Y9A%N%5I#RS%2H!I%2*e%2%!Z3
#A%2H!%!/&0/#(A*f3&!(:M3RL%2"&2K(&"&!7!B%2%2.&%2c%26
H!I%2!$*" G%2*R\&#A%25I#RS%2%!R6g.CT%26Y*D46Z%*4g
#a%!<R!h(6H!I%2!$":;<=%22].B%Hi5#Z%!/H!I%2%!K%2#A%2
2(*A9% !"#$%!7!B%25#A%2&Q6g%!%!`QA#a !0%55CQ !"
&!A&"&6Z%*%.42aj
UW!(.U?%#,&RY%2<>&!6=W45I!a%! !0%55H!I%2 !Q
45Y3:A%2*(%2#Z !"#$%!7%%(.C].&k%2*R\&&A42Q !" R/67
&!A&"&6Z%**+*&g @#N%C?%#,&%.*R\& !"#$%h*0/%!K%2%c5
**0/4lmC7%%(.*(%2*R\&G%2<=%2#1%2#+6Y:*0/R
%2!N%&G/&'(#Z&"&g *A%4Y%%!Rlm3#(&4)33m&#A:Anb
g.!g:42ajD&D!g:!A%!QAjo5!?%A*$#$%
H!(j"&6Z%*&'(!7!B%242ajD&k%2&![%!4%!K%2&]/!F
5*:p%2!N%&G/6#Q4SC
!"2/.N%3%c5
Nguyễn Thị Dung
CHƯƠNG 1:
TỔNG QUAN VỀ KIẾN TRÚC HƯỚNG DỊCH VỤ
(SERVICE-ORIENTED-ARCHITECTURE)
1.1. Kiến trúc phần mềm hiện nay
ộố kiến trúc phần mềm phân tán hiện nay
m1:B5I!a%!H?%#,& !]%"%*(%2:;<=%2 !f`?%%!Z!7%%(.
4ql3qm3rm36stlC"&H?%#,&%.4:5@#1%2&'(&"&!7
!B%2!RY%2*BR\%2`u%2&"&!&!A !i !]%"%&"&*BR\%2#N%59%2C
BR\%2&D!$&DH!I%22(%*>(&!J`N%%2AG%2<=%23!AX&@515".
H!"&:A6Y5".&!G(G%2<=%2#A%2H!6v%*R\&!(5&!?/:;<=%2%!R51
!0%&'(G%2<=%2C
RMI (Remote Method Invocation):
qm451 !0%&'(`1trOt(6(4(nA#5(%<(#<r)6)4A 5)%
P&'(/%64&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2%!Z6B&*1&!D%25X&'(:!(.
*f&I%2%2!7#A%2H!%2/e%%2]%:"&!`>!9%!„ Cm(.5‚%!(.36v%&E%&D
…
512Q !" *$2Q8/.?H!"A%<7%65V5XH!DH!c%%.6%D*+
*R\&#$%#$%H!(#A%2!&?CU?%#,&!RY%2<>&!6=WO)#6&)#)%)<
#&!)&/#)P4&"&!? &g%*$d].<%2!7!B%2&I%2%2!7!I%2%
&!A !i &"&<A(%!%2!7 g%<=%2%!K%22a*(%2&D6<}<%2!(.*f!)A
.N/&0/*$!w#\&!A<A(%!%2!7 C
SOA được xem như là bước phát triển tiếp theo của nghành công nghệ
phần mềm.
1.2. Kiến trúc hướng dịch vụ - SOA
ệ
SOA (Service Oriented Architecture) – Kiến trúc Định hướng Dịch vụ4
51&"&!? &g%!(.51 !RL%2 !" 4/g%*$!?H?6[&!!\ &"&!%!
!0%H!"&%!(/3`(A2e5&"& !0%556&"&&!G&%c%2#N%24M49!%!51
!7!B%2!A%&!J%!C?%#,&#Z2B%26Y&Z/#,&&'(&"& !0%55
!RY%2*BR\%22e5%!/5A</4)C/.%!N%H!"%755A</4)#A%2
H!I%2*L%!/0%4512D !0%553!(.51`1!R67%%A*DC!(.6A
*D35w5A</4)#A%251G%2<=%2451<>&!6=*R\&&/%2&Z #Q#"&@
%!/%LH!"&%!(/6&D!$#/.&g !I%28/(5I#RS%259%2CD51
&"&!%2‚%2V%351!7!B%2451g !\ %!/<>&!6=*R\&&/%2&Z
#N%59%23*R\&[&!!\ 496Y%!(/*$&T%2&1%2"&!&!7%&"&"&6=%A
*D!)A.N/&0/&'(H!"&!%2C
m1#A%2%!K%2&"&!!$/:(405%!Z64&A451&I%2
%2!7CmX&<T!A9*1%2*R\&4%!S&I%2%2!73%!R%2H!"&!!%2&0%
!Q&!/.$%*fh&!w&!J67&[&!!\ &I%2%2!7:(%267& !Q*/
&!J%!&"& !RL%2 !" !&!7%<"%3&![%!:"&!`QA#a6!(.*f*$*9
*R\&&"&4\[&!6H!Q%c%2#R@%2!%!6*" G%2C
Dịch vụ (service)4.?/B!)%&!B#A%2CD!$!$/<>&!6=%!R4
514A95A</4)!&!7%518/.#a%!%2!7 6=%A*DCm1#A%2%!K%25=&
*[&!&'(42, &"&G%2<=%2&D!$U2(A? W*R\&6Y%!(/5H!I%2
&0%`?&"&&!?H†!/g`N%#A%2C$!&!7%*/*D*>%!#(51
&!/-%2(A? O<T%2*$2V!5<>&!6=P*R\&*>%!%2!z(#‡#%26*1&4g
6Y%%Q%2!7!B%236&D!$":;<=%2C!R6g.34&Z *1&(A!L%
&'( !"#$%G%2<=%23&!,#V%2*?%8/.#a%!%2!7 6=6<T%22(A?
&!/-%*$2, &!)*: !G&9 H†!/g`N%<RYC#h/R\%24&B4‡&'(
ˆ
H!"%75<>&!6=3%D2, &!A&"&<A(%!%2!7 &D!$[&!!\ &"&!%! !0%
!7%&D6A&"&G%2<=%25Y6&"&!%! !0%%.&D!$*R\&&!(:M!AX&"
:;<=%2#A%2%!/4z%!6&H!"&%!(/&'(&I%2.*D5H!I%2&0% !Q&!J%!
:;(5+%2/e%!(. !Q"&Z/#,&49!7!B%2C
D549351<>&!6=&D&"&*X&*$5:(/
Có ranh giới rõ ràng (Boundaries Are Explicit):mw:)#6&)*R\&d].
<%2<(#N%&"&2(A&!/-%!D(*+*R\&:;<=%2#1%2#+C!?!7%
!&&'(5w:)#6&):pH!I%2*R\&!$!7%#(`N%%2ACmw:)#6&)&!J
&I%2`B51:B&"&2(A&'(%D&!A%2RS:;<=%2&D!$<T%2*$2@&"&
.N/&0/6%!g%H?8/Q#Q6C
Tính tự trị (Autonomous):5X4|!/.?35w:)#6&)&D[%!*1&4g
&(A3&D!$*R\&d].<%26*R(6A:;<=%25H!I%2 !=!/1&6A
&"&:)#6&)H!"&C
Share the Schema and Contract, Not the Class:5X#(A*f<K47/3
&"&:)#6&)H!I%2#/.%&"&&4(::6. )C!(.6A*D3&"&&4(::6. )
:p*R\&*X&Q!a%!!G&O<((*R\&*X&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!I%2&!J*L%!/0%465X&I%2%2!75%D
4f%2!E(&'(#Z%!/.?/B&I%2%2!73&L:@!90%23&A%%2RS6
8/.#a%!%2!7 6=C
Hình 2.4: Các thành phần tham gia triển khai hệ thống SOA
g.H!%A:;<=%2jD4H!!?H?!7!B%2*X#(51&]/!F
4Y%467&&]%%!‚&2K(H!Q%c%2:;<=%2496!7/%c%2&'(!7!B%2C?/!7
!B%2&0%67&&!9.%!(%!&!A51G%2<=%2*X&`7!aqm3ql3rm
4:4(&!V%C!R%2!7!B%2H!D&D!$!(.*f!AX&:;<=%249C?/!7
!B%2<*>%!!(.*f!RS%2d/.N%5H!I%2.N/&0/8/"&(A6B&*1!a
4 !RL%2&"&!? &g%B%!ZCD<}<%2:;<=%249#A%2RL%24(6
&!A !i &"&G%2<=%2RL%2*R\&!?H?51&"&!%!(%!&!D%2C
4R</.!7!B%2R/67&!A2(*A9%&I%2%2!7!7%%(.Cg.
45&"&!%A*$#$%H!(R</.*D6A&"&G%2<=%2!&?jD46Z%*6
&I%2%2!7C!0%? !)A:p#a%!`.51&I%2%2!7&D!$%D4!$!7%B
%!Z&!A!7%%(.’Web ServiceC
ˆ
2.2. SOA và ứng dụng Web Service
0ới thiệu về Web service
X&*$5&![%!&'(4"&!#S !0%2(A? 6Y !0%!&!7%
<>&!6=C/%.&!A !i &!,%2(4N%R@%2*?%51&I%2%2!7*R\&*&g
%!/!7%%(.~)`)#6&)C~)`)#6&)&!A !i #/.&g !I%28/(*>%!
%2!z(2(A!G&62(A? C
&L`Q%34H?%#,& !0%55 !"d/Zh*>%!%2!z(2(A?
6d].<%2A%`15I!a%!G%2<=%2%!R45I!a%!&"&2(A? 3!7%!&
2(A? 6 !RL%2!G&2V2(A? C(A? 4#/%2]5&'(A%`1#?4|
H?%#,&%.C!&#(3N%2VUH?%#,&*>%!!RY%22(A? W![&!!\ !L%
&!ACr>&!6=65A</4) !0%55%2!7 6=*R\&#/.&g !I%28/(2(A
? 3!RS%2!)A&"&!!G&.N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&!G&%c%2 !G&9 ^"&2(A!G&4
2(A!G&%)#%)*R\&:;<=%2%!/%!ZC
~)`)#6&)6Y5I!a%!!A9*1%2€`N%RL%2G%26Y5I!a%!!A9
*1%2&'(3:;<=%251`1&"&&!/-%&I%2%2!7CD4
•mo!/-%*>%!<9%2<K47/6!I%2*7 C
(A!G&<(#N%•mo6&!A !i 2(A? #N%5I
#RS%259%2C
~ro2I%%2K5IQ~)`)#6&)!)A&!/-%C
rrm1`1H!/%2&!/-%&!A !i 5I!a%!!D(6&=!$!D(&"&~)`
)#6&)*+*R\&*c%2H|C
Hình 2.5: Mô hình hoạt động của web service
Hoạt động của mô hình Web Service như sau:
Service ProviderrT%2~)`)#6&):r):&# A%o(%2/(2)O~roP*$
5IQ<>&!6=55a%!&D!$&/%2&Z 6d/Z`Q%O*c%2H|P6Y)#6&)
l#AH)#ORL%26Y)#6&)q)2:#.#A%2PC
Service Broker:oR/#K!I%2%6&"&:)#6&)*R\&&/%2&Z `@&"&
)#6&)#A6<)#C/%2&Z &!G&%c%2a5H?5!w#\)#6&)q)8/):)#
O)#6&)A%:/5)##A%2P#A%267&d"&*>%!)#6&)#A6<)# !T
!\ C!%! !0%&![%!&'()#6&)l#AH)#4&"&H!A4R/#K*R\&5IQ
`@%6)#:(4r:&A6)#.3r):&# A%3(%<%)2#(A%OrrPC
‹
Service Requester:rT%2~ro*$*X&Q%!/&0/:;<=%2O4A9:)#6&)3
!S2(%:;<=%23#):A/#&)&0%!?35G&2"CCCP62@&!A)#6&)
l#AH)#Clu%267&:;<=%2rr6&!G&%c%2a5H?5&'()#6&)
l#AH)#3)#6&)q)8/):)#&D!$a5!Z.)#6&)#A6<)#![&!!\ C
2(.:(/*D32K()#6&)q)8/):)#6)#6&)#A6<)#!?4g HN%!
2(A? :;<=%2*$!RL%24R\%22"&Q6&"&.?/BH!"&#A%2
67&:;<=%2:)#6&)C
!R6g.3:;<=%2~)`)#6&)&!A67&[&!!\ 2, G%2<=%2*9*R\&
%!K%25=&N/!)A%2/.N%4|
!I%28/(&"&&!/-%&I%2%2!7 C"&&!/-%%.2e5~)`)#6&)6Y
&"&*>%!%2!z(!%! !0%&!/-%&I%2%2!7 &!A•moC
;<=%2*R\&%!K%2 !0%55!RL%259*+d].<%2:_%%!/%!Z
&D!$C!0%55 !Q&/%2&Z &"&HN%!2(A? O(<( )#P&!A~)`
:)#6&)C
D%22D&"&G%2<=%2&!A !i H?!h(6Y2(A<7%*,%2!)A&!/-%
&I%2%2!7&!/%2C"&~)`)#6&)*/ !Q*R\&:;<=%2!I%28/(2(A
<7%%.C
;<=%2<K47/60%2<K47/*1&4g %u52K(&"&G%2<=%2*$-%*
&Z/#,&<K47/`N%<RYCmVRL%2"&6Y<K47/*/ !Q!I%28/(
~)`)#6&)C
o5!?%A~)`)#6&)&D!$*9*R\&%!K%25=&N/#N%j!,%2(
:p*6Ad)5di&!?&"&&I%2%2!76H†!/g!&!7%&'(~)`)#6&)C
5ấu trúc và chi tiết các thành phần của 1,*,.",
%Q%2&'(&"&<&!6=•)`2e5&"&.?/B•moO)•)%:`4)m(#H/
o(%2/(2)P3 O5 4) `y)& &&):: #AA&A4P3 rr O%6)#:(4
r):&# A%3 r:&A6)#. (%< %)2#(A%P3 ~ro O~)` )#6&): r):&# A%
o(%2/(2)PC
•
Hình 2.6: Các thành phần của Web service
2.2.3.1. XML - eXtensible Markup Language
•mo451&!/-%5@<A~€*R(#(6*R\& !"#$%hmoC •mo
451%2I%%2K5IQ6c%`Q%6Y&Z/#,&<A%2RS:;<=%2*>%!%2!z(3%D
*R\&:;<=%2*$*>%!%2!z(&"&!%! !0%<K47/#N%#(%2•)`6&!A%!K%2
47/llC
!a%!!G&3•mo!A%A%&D&Z/#,&!M2B%2%!R%2I%%2Kmo3
%!R%2H!I%2/]%!)A51*X&Q8/.RY&%!Rmo3%2RS:;<=%2!(.&"&
&!RL%2#a%!&D!$8/.RY&*>%!<9%2&"&(2•mo*$2(A? 6Y%!(/C#A%2
H!mo*>%!%2!z(!%! !0%*R\&!$%!>%!R!?%A!a•mo49*>%!
%2!z(%!K%2!%! !0%*D&!G(&"2aCY•mo3&"&!M&D!$*R\&4g #a%!
6N%9A#(#N%5w#(%2•)`6*R\&&!V%4*>%!<9%2!I%2*7 &!/-%`@
[%! !f`?%6!7/8/Q5+%2/e%5@C
rA~)`)#6&)4:H?!\ &'(%!/!%! !0%H!"&%!(/%N%%D:;
<=%2&"&[%!%c%26*X&#R%2&'(&"&!%! !0%*D*$2(A? Ca6g.•mo
4&I%2&=&![%!*$2Q8/.?6Z%*%.64H?%#,&%%Q%2&!A67&d].
<%251~)`)#6&)3Z&Q<K47/:p*R\&&!/.$%:(%2*>%!<9%2!M•moC
!*D3&"&!I%2%5+!D(:p!A%A% !T!\ 6Y&"&!I%2%!)A&!/-%
&'(!AX&•moq6&D!$RL%2"&6Y%!(/#A%251!$!B%2
%!ZC
[<=647/•mo
<?xml version="1.0" encoding = “UTF-8” ?>
<DOCUMENT>
<GREETING>
Xin Chào XML
•
</GREETING>
<MESSAGE>
Đây là chương trình XML đầu tiên
</MESSAGE>
</DOCUMENT>
47/•mo&!J&!G(<K47/3H!I%2%!‚&*?%&"&!#a%!`.C/%.
&D|%2!z(*D451XML parser3H!I%2&0% !Q!$/|%2!z(&'(&"&!MCD
&!J&0%a5&"&!M6d"&*>%!*].45147/•mo!\ 476a#a%!</.7
H!I%2&0% !Q!$/|%2!z(&'(&"&!M3%N%%2RS<T%2&D!$9A#(&"&!M`Z
Ha*$:;<=%2C
2.2.3.2. SOAP (Simple Object Access Protocol)
o512(A!G&<(#N%•mo*$&!A !i &"&G%2<=%2#(A*f!I%2
%8/(3*R\&!?H?*L%2Q%6<}5@#1%2CL%2Q%3451
2(A!G&*$#/.&g 51~)`)#6&)3512(A!G&#/.%!I%2!(.51*>%!
<9%2*$2;%%!‚%CZ&Q&"&!I%2*7 */*R\&5+!D(:;<=%2
•mo3&!A%N%H!I%2`>#%2`/1&`@`ZH”%2I%%2K4g #a%!%A!AX&&I%2
%2!7%ACa%!K%2*X&#R%2%.3%DH!I%28/(%]5*?%&I%2%2!72a*R\&:;
<=%2*$!&!7%5}%4%2RS<T%2:;<=%2&"&5)::(2)!)A*>%!<9%2
•moCRL%23:)#6&)&D!$*R\&!&!7%#A%2`ZH”%2I%%2K%A35}%
4%D&D!$d;4|*R\&%!K%25)::(2)!)A*>%!<9%2•moC
Hình 2.7: Mô hình gửi nhận thông điệp qua SOAP
l1H!/%2&'(51!I%2*7 `(A2e5
#AA&A4)(<)#!A`?!I%2%6&"&&!/-%2(A!G&*R\&:;<=%2C
s%6)4A !0%&![%!&'(!I%2*7 C!I%2%&![%!&'(5)::(2)
`(A2e5
{ )(<)#!G(&"&!)(<)#C
{ `A<.!I%2%6%(5)6<((*R\&*X&Q<RY<9%2
•moC2A#( &E% &D #RS%24w*R\&<T%2*$2@&"&•)`
:)#6&))d&) A%C
Hình 2.8: Cấu trúc của một SOAP message
Ví dụ:
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap=" />envelope"
soap:encodingStyle=" />encoding">
<soap:Header>
</soap:Header>
<soap:Body>
<soap:Fault>
</soap:Fault>
</soap:Body>
</soap:Envelope>
2.2.3.3. WSDL (Web Service Discription Language)
~ro451%2I%%2K<(#N%•mo<T%2*$5IQ2(A<7%&'(~)`
)#6&)CD&/%2&Z 51&"&!!G&&!/-%*$5IQ&"&H$/<K47/*R\&#/.%
#A%2&"&!I%2*7 !I%28/(~)`)#6&)3&"&!A9*1%2*R\&!&!7%#N%
&"&!I%2*7 6"%!d9&"&!A9*1%2%.*?%2(A!G&6g%&!/.$%C
{ ~ro<(#N%•moC
{ ~ro*R\&<T%2*$5IQ&"&~)`)#6&)C
{ ~ro*R\&<T%2*$d"&*>%!6>#[~)`)#6&)C
{ ~ro451&!/-%&'(~€C
~ro*>%!%2!z(&"&!5IQ~)`)#6&)!)A&, !" f%28/"&'(
•mo3`(A2e5&"&!I%2%
• N%<>&!6=C
• (A!G&6H$/5+!D(:p*R\&:;<=%2H!2V&"&!5&'(~)`
)#6&)C
• oA9!I%2%!(A"&3!(5:B3%!K%2H$/<K47/O&D!$42(A
<7%&'(~)`)#6&)&1%26YN%&!A2(A<7%%.PC
m1~ro!\ 472e5!( !0%
• !0%2(A<7%5IQ2(A<7%62(A!G&H?%BC
• !0%!!%!5IQ!I%2%*$#/.d/Z:)#6&)C
Q!( !0%%.:p*R\&4R/#A%2g %•mo
• g %2(A<7%:)#6&)O&!A !0%PC
• ậ %!!%!:)#6&)O&!A !ầ%PC
Hình 2.9: Cấu trúc WSDL
Tập tin giao diện - Service Interface
m147/~ro5IQ51~)`)#6&)2e5&"&!%! !0%&![%!
Element Defines
•. ):– "&H$/<K47/*R\&:;<=%2`@&"&~)`)#6&)
•5)::(2)– "&!I%2*7 *R\&:;<=%2`@&"&~)`)#6&)
• A#. )– "&!A9*1%2*R\&!&!7%`@&"&~)`)#6&)
•`%<%2– "&2(A!G&#/.%!I%2*R\&:;<=%2`@&"&~)`)#6&)
Z/#,&5147/~ro:p%!R:(/
<definitions>
<types>
definition of types
</types>
<message>
definition of a message
</message>
<portType>
definition of a port
</portType>
<binding>
definition of a binding
</binding>
</definitions>
m147/~ro&k%2&D!$&D&"&.?/BH!"&3%!R!%! !0%5@
#1%236&"&.?/B51<>&!6=545&!A%D%!D5496Y%!(/*$&D!$*>%!
%2!z(&'(51:B~)`)#6&)#A%25147/~roC
Tập tin thi hành - Service Implementation
~ro5IQ4A9!I%2%&![%!`(A2e5:)#6&)6 A#C
Dịch vụ (Service)
!&!7%%!K%22a*+*R\&*>%!%2!z(#A%2g %2(A<7%6&"&!
2V•)`:)#6&):!)A!'=&6 !RL%2!G&%A*D
<wsdl: definitions >
<wsdl: service name="nmtoken">
<wsdl: port />
€