http:// lhu.edu.vn 3 Các bước xây dựng Web Service Tạo Web services.. Cho khởi động file service.asmx Kiểm tra Web service Sử dụng Web service do mình tạo ra Sử dụng Web ser
Trang 1LHU
http://lhu.edu.vn
1
LẬP TRÌNH WEB ASP.NET
Ts Vũ Đức Lung
Ks Phan Hữu Tiếp
Web Service
Chương 7:
Trang 2http:// lhu.edu.vn
2
Web Service
Trang 3http:// lhu.edu.vn
3
Các bước xây dựng Web Service
Tạo Web services Cho khởi động file service.asmx
Kiểm tra Web service
Sử dụng Web service do mình tạo ra
Sử dụng Web service được cung cấp miễn phí trên mạng
Trang 4http:// lhu.edu.vn
4
Tạo Web Service
Trang 5http:// lhu.edu.vn
5
Tạo Web Service
Public Function Cong(ByVal pA As Integer, ByVal pB As Integer) As Integer
Dim lTong As Integer lTong = pA + pB
Return lTong End Function
Trang 6http:// lhu.edu.vn
6
Kiểm tra Web Service
Trang 7http:// lhu.edu.vn
7
Sử dụng Web Service do mình tạo ra
Trang 8http:// lhu.edu.vn
8
Sử dụng Web Service do mình tạo ra
Trang 9http:// lhu.edu.vn
9
miễn phí trên mạng
Trang 11http:// lhu.edu.vn
11
Các bước sử dụng webservice
Trang 12http:// lhu.edu.vn
12
Các bước sử dụng webservice
http://www.webservicex.net/country.asmx?wsdl
Trang 14Thể hiện các thông tin của webservice
Trang 15Kết nối thông tin hiển thị
protected void Page_Load(object sender, EventArgs e)
{
// Hiển thị tỷ giá ngoại tệ
WS_TyGia.CurrencyConvertor TyGia = new WS_TyGia.CurrencyConvertor(); lblUSD.Text = TyGia.ConversionRate(WS_TyGia.Currency.USD,
WS_TyGia.Currency.VND).ToString(); lblEUR.Text = TyGia.ConversionRate(WS_TyGia.Currency.EUR,
WS_TyGia.Currency.VND).ToString(); lblGBP.Text = TyGia.ConversionRate(WS_TyGia.Currency.GBP,
WS_TyGia.Currency.VND).ToString();
// Hiển thị thông tin thời tiết
WS_ThoiTiet.GlobalWeather thoitiet = new WS_ThoiTiet.GlobalWeather();
lblHCM.Text = thoitiet.GetWeather("Ho Chi Minh", "Viet Nam");
lblHaNoi.Text = thoitiet.GetWeather("Ha Noi", "Viet Nam");
// Hiển thị các thành phố Việt Nam
lblCities.Text = thoitiet.GetCitiesByCountry("Viet Nam");
// Hiển thị các nước trên thế giới và đơn vị tiền tương ứng
WS_QuocGia.country quocgia = new WS_QuocGia.country();
lblQuocGia.Text = quocgia.GetCountries();
lblTien.Text = quocgia.GetCurrencies();
}
Trang 17http:// lhu.edu.vn
17
Kiểm tra File Format & File Size
Trang 18http:// lhu.edu.vn
18
Gửi mail sử dụng Client Mail
Trang 19http:// lhu.edu.vn
19
Gửi mail sử dụng Client Mail
Trang 20http:// lhu.edu.vn
20
Gửi mail sử dụng Client Mail
Kết quả sẽ đưa vào Client Mail default
Trang 21http:// lhu.edu.vn
21
Gửi Email sử dụng Remote Server
Trang 22http:// lhu.edu.vn
22
Gửi Email sử dụng Remote Server
Trang 23LHU
http://lhu.edu.vn
23