1.创建idl文件,文件格式与java接口保持一致

2.编译idl接口,运行命令:idlj -fall xxx.idl

3.运行orb,运行命令:start orbd -port 1050 -ORBInitialPort 1049 -ORBInitialHost localhost

4.实现服务器端

    (1).创建xxxImpl.java文件,继承命令生成的xxxPOA.java文件编写远程调用的实现

    (2).创建服务端运行文件,格式如下:

    String args[] = new String[2];

    args[0] = "-ORBInitialPort";

    args[1] = "1050";//端口

    ORB orb = ORB.init(args, null);  

    POA rootpoa = (POA)orb.resolve_initial_references("RootPOA");  

    rootpoa.the_POAManager().activate();  

    xxxImpl xxxImpl = new xxxImpl();  

    org.omg.CORBA.Object ref = rootpoa.servant_to_reference(xxxImpl);  

    xxx href = xxxHelper.narrow(ref);  

    org.omg.CORBA.Object objRef =                           orb.resolve_initial_references("NameService");  

    NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);  

    NameComponent path[] = ncRef.to_name("xxx");  

    ncRef.rebind(path, href);  

    orb.run();  

5.客户端调用,创建客户端方法格式如下:

    String args[] = new String[4];

     args[0] = "-ORBInitialHost";

     args[1] = "127.0.0.1";// 服务端的IP地址

     args[2] = "-ORBInitialPort";

     args[3] = "1050";// 服务端的端口

     ORB orb = ORB.init(args, null);

     org.omg.CORBA.O


bject objRef = null;

     objRef = orb.resolve_initial_references("NameService");

     NamingContextExt neRef = NamingContextExtHelper.narrow(objRef);

     xxx x =  BillingAppHelper.narrow(neRef.resolve_str("xxx"))