Example
The Java server:
Interface : Callback\ServerAdmin.java
Implementation: Callback\ServerAdminImpl.java
public class ServerAdminImpl extends PortableRemoteObject implements ServerAdmin{
// ...
public void regCallBack( String name, Greetings oCallBack) throws RemoteException {
oCallBack.hello( "Hi " + name));
}
}
Callback interface: Callback\Greetings.java
public interface Greetings extends Remote {
String hello( String name)
throws RemoteException;
}
The .Net client:
Implementation: ClientImpl.cs
IDL-File : Callback.idl
Generated : Callback.cs
The implementation of the .Net callback object within ClientImpl.cs
(Callback.GreetingsPOA is generated class):
public class GreetingsImpl: Callback.GreetingsPOA
{
public string m_strMessage;
public GreetingsImpl()
{
}
override public string hello( string a_strMessage )
{
m_strMessage = "Method executed: Greetings.hello( "+ a_strMessage + ")" ;
return "Thanks for callback";
}
}
Instantiate the .Net callback object and call of the remote java interface:
Callback.Greetings oGreetings = new GreetingsImpl()._this();
oServerAdmin.regCallBack( "Middsol", oGreetings);