tailieunhanh - Interface-Oriented Design phần 9

Một khi các trang web du lịch có xác nhận đặt phòng của bạn, trang web trả về một tài liệu xác nhận: Tài liệu: Xác định hành khách đặt phòng ReservationConfirmation FareAllInclusive Chân [] Số chuyến bay xứ Điểm đến Ngày giờ khởi hành Ngày giờ đến | Design 164 Design We have two parts to design the remote client and the ServiceRegistry server. Let s first work on the communication between the two. We will use document-style interfaces see Chapter 6 to communicate between the two systems. This style allows communication between different types of platforms and languages. The Document Interface With this service registry the documents match the three actions register unregister and lookup. The documents contain a common element ServiceProviderlnformation Data ServiceProviderInformation ServicelD Connectioninformation ServiceProviderlD Document Registration Version ServiceProviderInformation Document RegistrationResponse Version Status Success or failure Document Unregistration Version ServiceProviderInformation Document LookupRequest Version ServiceID Document LookupResponse Version ServiceID Connectioninformation We added a Version to each document. We know we have potential changes but we don t know whether or when we are going to make those changes. The version identifier allows both the server and the client to easily distinguish between the current and older versions. The document flow interface protocol appears in Figure on the next page. Figure Document flow Since we are not in control of the code the Serviceprovider uses for submittal the server should validate the document before further processing it. These documents do not have much data to validate. The Version should be a recognized one. The ServiceProviderlD ServicelD and Connectioninformation should follow a prescribed format. We figured out the information we need to convey in the documents but we haven t specified the format. We also haven t specified the format that will be used to transmit and receive the documents. Our document flow should be independent of the format and protocol as discussed in Chapter 6. In the next section we ll create an interface to these documents to simplify their use. Implementation We ll create .