⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 client.java

📁 基于ruby的进阶编程,大家可以对照教材<<Ruby on Rails快速Web应用开发实战>>,效果会更好
💻 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 + -