Hello
I have problem with the following code
On the line --- InterfaceDef
if_def=InterfaceDefHelper.narrow(obj._get_interface_def());----
get_interface_def() returns null
Ir service is ok and running I can see the IR contents with irbrowser
In version 2.2.1 a bug is reported about this subject and the solution is
given like:
......the problem seems to be in ServantDelegate. during _invoke the
deprecated method
_get_interface is called. replacing _get_interface with _get_interface_def
seems
to fix the problem.........
I am using latest Jacorb version 2.3.0 and this bug is fixed there
What might be the problem Any idea? I am waiting for your help
import java.io.*;
import org.omg.CORBA.*;
import org.omg.CORBA.InterfaceDefPackage.*;
import org.omg.CosNaming.*;
public class DiiClient
{
public static void main(String args[])
{
String ior =new String(args[0]);
try{
ORB orb = ORB.init(args, null);
org.omg.CORBA.Object obj=orb.string_to_object(ior);
System.out.print(ior);
----> InterfaceDef
if_def=InterfaceDefHelper.narrow(obj._get_interface_def());
----->////if_def is null
//// get full interface dscription
FullInterfaceDescription full_if_desc =if_def.describe_interface();
int no_of_parameters;
// print various information
System.out.println("Querying the Interface Repository\n");
System.out.println("interface " + full_if_desc.name + " has " +
full_if_desc.operations.length + " operations and " +
full_if_desc.attributes.length + " attributes." );
System.out.println("interface " + full_if_desc.name + " {" );
for( int i = 0; i < full_if_desc.attributes.length; i++ )
{
System.out.println(" attribute " +
full_if_desc.attributes.name );
}
for( int i = 0; i < full_if_desc.operations.length; i++ )
{
no_of_parameters =
full_if_desc.operations.parameters.length;
System.out.println(" " +
// print the type code of the operation's
result
full_if_desc.operations.result + " " +
// print the name of the operation
full_if_desc.operations.name + " ("
);
// define and initialise text representations
// for parameter modes
String mode, in, inout, out;
in = new String("in");
inout = new String("inout");
out = new String("out");
char last_char = ',';
// print parameters of the operations
for( int j = 0; j < no_of_parameters; j++ )
{
// set the right text for the parameter mode
switch
(full_if_desc.operations.parameters[j].mode.value() ) {
case ParameterMode._PARAM_IN:
mode = in; break;
case ParameterMode._PARAM_INOUT:
mode = inout; break;
case ParameterMode._PARAM_OUT:
mode = out; break;
default:
mode = new String("unknown mode");
}
// deal with separating commas
if( j == no_of_parameters - 1 )
last_char = ' ';
// print mode, type and name of the parameter
System.out.println(" " +
mode + " " +
full_if_desc.operations.parameters[j].type + " " +
full_if_desc.operations.parameters[j].name + last_char
);
}
System.out.println(" );");
}
System.out.println("\n};\n");
}
}
}
I have problem with the following code
On the line --- InterfaceDef
if_def=InterfaceDefHelper.narrow(obj._get_interface_def());----
get_interface_def() returns null
Ir service is ok and running I can see the IR contents with irbrowser
In version 2.2.1 a bug is reported about this subject and the solution is
given like:
......the problem seems to be in ServantDelegate. during _invoke the
deprecated method
_get_interface is called. replacing _get_interface with _get_interface_def
seems
to fix the problem.........
I am using latest Jacorb version 2.3.0 and this bug is fixed there
What might be the problem Any idea? I am waiting for your help
import java.io.*;
import org.omg.CORBA.*;
import org.omg.CORBA.InterfaceDefPackage.*;
import org.omg.CosNaming.*;
public class DiiClient
{
public static void main(String args[])
{
String ior =new String(args[0]);
try{
ORB orb = ORB.init(args, null);
org.omg.CORBA.Object obj=orb.string_to_object(ior);
System.out.print(ior);
----> InterfaceDef
if_def=InterfaceDefHelper.narrow(obj._get_interface_def());
----->////if_def is null
//// get full interface dscription
FullInterfaceDescription full_if_desc =if_def.describe_interface();
int no_of_parameters;
// print various information
System.out.println("Querying the Interface Repository\n");
System.out.println("interface " + full_if_desc.name + " has " +
full_if_desc.operations.length + " operations and " +
full_if_desc.attributes.length + " attributes." );
System.out.println("interface " + full_if_desc.name + " {" );
for( int i = 0; i < full_if_desc.attributes.length; i++ )
{
System.out.println(" attribute " +
full_if_desc.attributes.name );
}
for( int i = 0; i < full_if_desc.operations.length; i++ )
{
no_of_parameters =
full_if_desc.operations.parameters.length;
System.out.println(" " +
// print the type code of the operation's
result
full_if_desc.operations.result + " " +
// print the name of the operation
full_if_desc.operations.name + " ("
);
// define and initialise text representations
// for parameter modes
String mode, in, inout, out;
in = new String("in");
inout = new String("inout");
out = new String("out");
char last_char = ',';
// print parameters of the operations
for( int j = 0; j < no_of_parameters; j++ )
{
// set the right text for the parameter mode
switch
(full_if_desc.operations.parameters[j].mode.value() ) {
case ParameterMode._PARAM_IN:
mode = in; break;
case ParameterMode._PARAM_INOUT:
mode = inout; break;
case ParameterMode._PARAM_OUT:
mode = out; break;
default:
mode = new String("unknown mode");
}
// deal with separating commas
if( j == no_of_parameters - 1 )
last_char = ' ';
// print mode, type and name of the parameter
System.out.println(" " +
mode + " " +
full_if_desc.operations.parameters[j].type + " " +
full_if_desc.operations.parameters[j].name + last_char
);
}
System.out.println(" );");
}
System.out.println("\n};\n");
}
}
}