Example
The Java server:
Interface : ObjectByValue\Greetings.java
Implementation: ObjectByValue\GreetingsImpl.java
Serializable : ObjectByValue\Info.java
public class Info implements Serializable {
private String name;
private String message;
public String getName()
{
return name;
}
public String getMessage()
{
return message;
}
// ...
}
The .Net client:
Implementation: ClientImpl.cs
IDL-File : ObjectByValue.idl
Generated : ObjectByValue.cs
On the .Net side an abstract class named 'Info' is generated. This class holds the same signature and the data
as the java class 'Info', but because the implementation of its functions is not available during the generation
process from the IDL file, an implementation class derived from 'Info' (here named 'InfoImpl') has to be created.
public abstract class Info : Middsol.CORBA.portable.StreamableValue
{
protected string name;
protected string message;
abstract public string getName( );
//...
}
Serializable Implementation: InfoImpl.cs
public class InfoImpl: ObjectByValue.Info
{
public InfoImpl()
{
}
public InfoImpl( String a_arg0, String a_arg1, String a_arg2, String a_arg3)
{
}
override public string name
{
set { this.name_ = value; }
get { return this.name_; }
}
override public string message
{
set { this.message_ = value;}
get { return this.message_; }
}
}
Note, that we have to add several items to the list of assemblies to be searched for
by the .Net Reflection. This list is set using the "-AddAssembly" parameter during ORB
initialization:
private static string[] m_strORBInit = {"-ORBEndpoint iiop://localhost:8545/portspan=100",
"-ORBInitRef NameService=corbaloc:iiop:1.2@localhost:1050/NameService",
"-ORBDebug",
"-AddAssembly DotNetClient.exe,JavaBuiltinTypesCF.dll,MinCorCF.dll" };