Programming Web Services with SOAPn phần 4

Các chức năng tiện ích Bây giờ chúng ta bắt đầu xác định các dịch vụ Nhà xuất bản web thực tế. Ví dụ 4-5 cho thấy một số chức năng tiện ích tư nhân, chủ yếu là để đối phó với việc tạo ra và xác nhận các thẻ ủy quyền được sử dụng như là một phần của mô hình bảo mật của dịch vụ Nhà xuất bản (được thảo luận sau). | Programming Web Services with SOAP where WHERE where if where returns row in array context and first element memberID in scalar return dbh- selectrow array SELECT FROM members where values parameters sub update member sub insert item sub select item sub select all items sub delete_item Utility Functions Now we start defining the actual Publisher web service. Example 4-5 shows several private utility functions primarily for dealing with the creation and validation of the authorization tokens used as part of the Publisher service s security model discussed later . Example 4-5. Utility functions package Publisher use POSIX qw strftime @Publisher ISA qw SOAP Server Parameters use Digest MD5 qw md5 my calculateAuthInfo sub return md5 join unique yet persistent string @_ my checkAuthInfo sub my authInfo shift my signature calculateAuthInfo- @ authInfo qw memberID email time die Authentication information is not valid n if signature ne authInfo- signature die Authentication information is expired n if time authInfo- time return authInfo- memberID my makeAuthInfo sub my memberID email @ my time time 20 60 my signature calculateAuthInfo- memberID email time return memberID memberID time time email email signature signature Register a New User Example 4-6 shows the code for the exported operation that registers new users. page 66 Programming Web Services with SOAP Example 4-6. Exported method to register a new user sub register my self shift my envelope pop my parameters envelope- method die Wrong parameters register email password firstName . lastName title company url n unless 4 map defined @parameters qw email password firstName lastName my email parameters email die Member with email email already registered n if Publisher DB- select member email email return Publisher DB- insert member parameters Modify User Information Example 4-7 is the operation that allows users to modify their information. Example 4-7. Exported subroutine to modify a user s .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.