要求服务器端使用JDK1.4,客户端使用Delphi6/7,采用IIOP互联,不使用visibroker,请教高高手,如果实现互联,最好能提供实例或是相关主页文章连接。分数不是问题,答得的创意,送上几百分!

解决方案 »

  1.   

    为方便答复,提供服务器端相关文档:
    IDL文件如下:
    module ArithApp {
       interface Add {
          const unsigned short SIZE=10;
          typedef long array[SIZE];
          void addArrays(in array a, in array b, 
            out array result);
       };
    };
      

  2.   

    服务程序AddServer.java
    import ArithApp.*;
    import org.omg.CORBA.*;
    import org.omg.CosNaming.*;
    import org.omg.PortableServer.*;
    import org.omg.PortableServer.POA;public class AddServer { public static void main(String args[]) {
    try {
    // create and initialize the ORB
    ORB orb = ORB.init(args, null); // create an implementation and register it with the ORB
    AddImpl impl = new AddImpl(orb); // get reference to rootpoa & activate the POAManager
    POA rootpoa =
    POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
    rootpoa.the_POAManager().activate(); // get object reference from the servant
    org.omg.CORBA.Object ref = rootpoa.servant_to_reference(impl);
    Add href = AddHelper.narrow(ref); // get the root naming context
    // NameService invokes the name service
    org.omg.CORBA.Object objRef =
    orb.resolve_initial_references("NameService");
    // Use NamingContextExt which is part of the Interoperable
    // Naming Service (INS) specification.
    NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef); // bind the Object Reference in Naming
    String name = "Add";
    NameComponent path[] = ncRef.to_name(name);
    ncRef.rebind(path, href); System.out.println("AddServer ready to add up your arrays...."); // wait for invocations from clients
    orb.run();
    } catch (Exception e) {
    System.err.println("ERROR: " + e);
    e.printStackTrace(System.out);
    }
    System.out.println("AddServer Exiting ....");
    }
    }
      

  3.   

    接口实现程序AddImpl.java
    import ArithApp.*;
    import org.omg.CORBA.*;class AddImpl extends AddPOA {
    private ORB orb; public AddImpl(ORB orb) {
    this.orb = orb;
    } // implement the addArrays() method
    public void addArrays(
    int a[],
    int b[],
    ArithApp.AddPackage.arrayHolder result) { result.value = new int[ArithApp.Add.SIZE]; for (int i = 0; i < ArithApp.Add.SIZE; i++) {
    result.value[i] = a[i] + b[i];
    }
    }
    }
      

  4.   

    我们做的是这样的。CORBA服务放到TUXETO上,EJB放到WEBLOGIC,TUXETO跟WEBLOGIC之间用WTC连接。前台用STRUTS开发的页面来调用EJB。我想用DELPHI当克户端原理也差不多。