代码:
public static void main(String[] args) {
try {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the BookName:");
String bookName = br.readLine();
System.out.println("Book Id is: " +bookInfo(bookName).getBookAvail().get(0).getBookID().toString());
System.out.println("Book Name is: " +bookInfo(bookName).getBookAvail().get(0).getBookName().toString());
} catch (IOException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
try {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the StudentID:");
String studentID = br.readLine();
System.out.println("Student Information is: " +studentInfo(studentID));
} catch (IOException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}
private static ArrayOfBookAvail bookInfo(java.lang.String bookName) {
org.tempuri.BookService service = new org.tempuri.BookService();
org.tempuri.IBookService port = service.getBasicHttpBindingIBookService();
return port.bookInfo(bookName);
}
private static ArrayOfStudInfo studentInfo(java.lang.String studentID) {
org.tempuri.BookService service = new org.tempuri.BookService();
org.tempuri.IBookService port = service.getBasicHttpBindingIBookService();
return port.studentInfo(studentID);
}
}
我得到的输出是:
Enter the BookName:
Core Servlets and JavaServer Pages, Volume 2:Advanced Technologies
Book Id is: javax.xml.bind.JAXBElement@196da649
Enter the StudentID:
13MCAL058
Student Information is: org.datacontract.schemas._2004._07.lms.ArrayOfStudInfo@2b08bc5a
请帮助获得正确的输出。先感谢您。