?? taclient.java
字號:
package com.ibm.ta.client;
import java.rmi.RemoteException;
import javax.xml.rpc.ServiceException;
import com.ibm.ta.webservice.Course;
import com.ibm.ta.webservice.Student;
import com.ibm.ta.webservice.TAService;
import com.ibm.ta.webservice.TAServiceException;
import com.ibm.ta.webservice.TAServiceServiceLocator;
public class TAClient {
public static void main(String[] args) {
// Get the service locator
TAService service = null;
TAServiceServiceLocator serviceLocator = new TAServiceServiceLocator();
try {
serviceLocator
.setTAServiceEndpointAddress("http://localhost:9080/TAWebService/services/TAService");
service = serviceLocator.getTAService();
} catch (ServiceException se) {
se.printStackTrace();
System.exit(1);
}
try {
Student[] students = service.listStudents();
Course[] courses = service.listCourses();
System.out.println("Enrolling " + students[0].getName() + " in "
+ courses[0].getName());
service.enroll(students[0].getId(), courses[0].getId());
} catch (TAServiceException tase) {
System.out.println(tase);
System.out.println(tase.getMessage());
System.exit(1);
} catch (RemoteException re) {
re.printStackTrace();
System.exit(1);
}
;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -