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

📄 helloclientjndi.java

📁 精通EJB3.0一书的全部随书实例的源代码。
💻 JAVA
字号:
package examples;

import java.net.URL;
import javax.xml.rpc.Service;
import javax.xml.rpc.JAXRPCException;
import javax.xml.namespace.QName;
import javax.xml.rpc.ServiceFactory;
import javax.naming.Context;
import javax.naming.InitialContext;

/**
 * This class is an example of client code which invokes
 * methods on a simple stateless session bean.
 */
public class HelloClientJNDI {

    public static void main(String[] args) 
        throws Exception 
    {        
        InitialContext ctx = new InitialContext();
        Service helloService = (Service)ctx.lookup("HelloWorldWS");

        HelloInterface hello =
            (examples.HelloInterface)helloService.getPort(examples.HelloInterface.class);               
        /*
         * Call the hello() method 
         */
        System.out.println(hello.hello());

    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -