FileDocCategorySizeDatePackage
HeaderBookServiceClient.javaAPI DocExample2194Tue Dec 17 22:56:06 GMT 2002ora.jwsnut.chapter6.client

HeaderBookServiceClient

public class HeaderBookServiceClient extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

        
        try {
            // Get a reference to the stub.
            HeaderBookService_Impl service = new HeaderBookService_Impl();
            HeaderBookQuery bookQuery = (HeaderBookQuery)service.getHeaderBookQueryPort();
            
            // Create the required authentication information
            String userName = System.getProperty("HeaderBooks.user");
            String password = System.getProperty("HeaderBooks.password");
            Authentication auth = new Authentication(userName, password);
            
            // Get info for each book.
            StringHolder stringHolder = new StringHolder();
            CalendarHolder calendarHolder = new CalendarHolder();

            int count = bookQuery.getBookCount(auth, calendarHolder);
            Calendar calendar = (Calendar)calendarHolder.value;
            System.out.println("Book count = " + count);
            System.out.println("Processed at: " + calendar.getTime());

            for (int i = 0; i < count; i++) {
                String title = bookQuery.getBookTitle(i, auth, calendarHolder);
                bookQuery.getBookAuthor(title, stringHolder, auth, calendarHolder);
                System.out.println("Title: " + title + ", author: " + stringHolder.value);                
            }
            
            // Log success
            bookQuery.log("HeaderBookServiceClient: success", auth, calendarHolder);
            
            System.exit(0);
        } catch (Throwable t) {
            System.out.println("CLASS: " + t.getClass().getName() + "\n\n");
            System.out.println(t.getMessage());
            t.printStackTrace(System.out);
        }