Thứ Năm, 14 tháng 8, 2014

Developing web service using JAX-WS

Demo : Happy Consumer International Bank (HCIB), a leading multinational organization having established branches all over the world is now starting its banking services in India. The Bank has employed you as a full time System Consultant with them. It wants to deploy a Web Service that will offer credit card validation and online banking facilities that are typically offered by all the multinational banks. The main priorities for the online banking system are reliability, availability and serviceability of the application. Additionally, the system should be highly scalable and secure as the bank expects substantial growth in the future. Consider yourself to be a part of the team that implements the credit card validation module. Develop a JAX_RPC based Web Service that exposes the boolean validateCreditCard(cardNumber) method. This method implements the logic for credit card number validation, and returns a boolean value indicating whether the card number is valid or not.

Bước 1: Tạo new project JavaWeb



Bước 2: Thêm Web Services

Bước 3: Viết code cho file web services




Test thử web services


Bước 4: Tạo new project Java



Bước 5: Thêm Web Services Client



Copy WSDL vừa test thử vào WSDL URL



Bước 5:Kéo method validateCart vào file main




Bước 6: Viết code cho file main



Kết quả



Demo: https://drive.google.com/file/d/0B-EFzewQLSMDRnJQblltbXVxbEU/edit?usp=sharing

Nhận xét:
- Một web service sử dụng giao thức chuẩn mở nên có thể dùng cho nhiều client
- Dễ dàng sửa chữa web service mà không ảnh hưởng đến client
- Code kết nối client với service rất đơn giản và gọn gàng
- Tuy nhiên, ứng dụng khá chậm

Không có nhận xét nào:

Đăng nhận xét