Professional Documents
Culture Documents
H Th Hong Vy
C BN
Web Service
Trong ng dng SOA dng Web Service, ta cn quan tm
To web service
Service
Client
Lu
Giao din kim th hm ca Web Service
ch chy c my cc b (localhost)
10
11
Internet Information Services (IIS) Manager Add Application vo Default Web Site
Click phi Default Web Site > Add Application t Alias cho Web Service Chn th mc cha Web Service Physical Path
12
13
14
Lu
Khng nn t th mc cha Web Service
cc th mc ring ca user
Desktop My Documents ...
15
16
i ng dn Web Service
17
V d 1
18
M t
Xy dng 1 ng dng/web site cho php dch Php-Vit
c web service dch Php-Anh c web service dch Anh-Vit
19
M hnh
French Php-Anh
French
English
Vietnamese
Anh-Vit
Vietnamese
20
Ci t
Web Service Php-Anh (.asmx.cs)
[WebMethod] public string Translate(string french) { return Lookup(french); } public string Lookup(string word) { // Ci t hm tm t ting Php trong csdl // tr ra t ting Anh tng ng }
21
Ci t
Web Service Anh-Vit (.asmx.cs)
[WebMethod] public string Translate(string english) { return Lookup(english); } public string Lookup(string word) { // Ci t hm tm t ting Anh trong csdl // tr ra t ting Vit tng ng }
22
Ci t
ng dng dch Php-Vit
public string Translate(string french) { // Gi web service Php-Anh FEService proxyFE = new FEService(); string english = proxyFE.Translate(french); // Gi web service Anh-Vit EVService proxyEV = new EVService(); string vietnamese = proxyEV.Translate(english); return vietnamese; }
23
Lu
i vi .NET framework 4.0:
S khng tm thy: ASP.NET Web Service thay vo l WCF Cch to:
File>New Project > ASP.NET Empty Web application Right click project > add new item > web service
36
Lu
Khi s dng, thay v add web references th : add service references Chn advanced > add web references
37
38
39
Thank You!
41
Dynamic webservice
Link: http://www.codeproject.com/KB/webservices/Dynamic_Invoke_webser vice.aspx Link: http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/391 38d08-aa08-4c0c-9a58-0eb81a672f54
42