ObjectByValue - Java Serializables

Description:

The server exports a function which has a serializable object as parameter and as return value.

Source:

\DemoJava\ObjectByValue

Mapping:

java.io.Serializable <---> Ics.CORBA.portable.StreamableValue


Example

Step 1. Write the Java server:

  public class Info implements Serializable  
  {
    private String name;
    private String message;
    public String getName()
    {
      return name;
    }
    public String getMessage()
    {
      return message;
    }
    ...
  }	

Step 2. Write the .NET client:

On the .NET side an abstract class named 'Info' is generated. This .NET class contains the same methods and members as the java class 'Info'. Because the implementation of its functions is application dependent an implementation class derived from 'Info' (here named 'InfoImpl') has to be created explicitly.

  public abstract class Info : Ics.CORBA.portable.StreamableValue  
  {
    protected string name;
    protected string message;
    abstract public string getName( );	
    ...
  }

Serializable Implementation: InfoImpl.cs

  public class InfoImpl: Info
  {
    override public string getName( )  
    {
      return this.name;
    }
  }

Step 3. Run the example

a.) Start the sun name service on port 10050:

    > start orbd -ORBInitialPort 10050  

(could also use startNameService.bat located in the DemoJava directory to quick start the name service)

b.) Start the java server by using JNDI CosNaming and work with a name service running on 'localhost' at port '10050':

    > start java -cp .;Server.jar -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory -Djava.naming.provider.url=iiop://localhost:10050 Server  

(could also use buildServer.bat and startServer.bat located in the JavaServer directory to quick build and run the Java Server)

c.) Start the .NET Client.