FileDocCategorySizeDatePackage
DocBookServiceClient.javaAPI DocExample1733Tue Dec 17 20:43:38 GMT 2002ora.jwsnut.chapter6.client

DocBookServiceClient

public class DocBookServiceClient extends Object

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

        
        try {
            // Get a reference to the stub.
            DocBookService_Impl service = new DocBookService_Impl();
            DocBookQuery bookQuery = (DocBookQuery)service.getDocBookQueryPort();

            // Get info for each book.
            int count = bookQuery.getBookCount();
            for (int i = 0; i < count; i++) {
                String title = bookQuery.getBookTitle(i);
                BookInfo info = bookQuery.getBookInfo(title);
                if (info != null) {
                    System.out.print("Title: " + title + ", author: " + info.getAuthor() +
                                         ", price: " + info.getPrice() + " USD. Stock: ");
                    SOAPElement element = bookQuery.getStockInfo(title);
                    if (element != null) {
                        int stock = Integer.parseInt(element.getValue());
                        System.out.println(stock);
                    } else {
                        System.out.println("unknown");
                    }
                }
            }
            System.exit(0);
        } catch (Throwable t) {
            System.out.println("CLASS: " + t.getClass().getName() + "\n\n");
            System.out.println(t.getMessage());
            t.printStackTrace(System.out);
        }