📄 client.java
字号:
package ActionWebService;
import java.net.URL;
public class Client {
private static int categoryId = 1;
/**
* @param args
*/
public static void main(String[] args) {
try {
ServiceLocator scLocator = new ServiceLocator();
ItemBindingStub itemClient = new ItemBindingStub(new URL(scLocator
.getItemPortAddress()), null);
Item[] items = itemClient.findAllItems();
CategoryBindingStub categoryClient = new CategoryBindingStub(
new URL(scLocator.getCategoryPortAddress()), null);
Category category = categoryClient.findCategoryById(categoryId);
System.out.println("id:" + items[0].getId() + "; title:"
+ items[0].getTitle() + ";");
System.out.println("id:" + category.getId() + "; name:"
+ category.getName() + ";");
} catch (Exception e) {
e.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -