Return a object which implements the service.
// Read deployment descriptor options
String orbInitialHost = getStrOption(OPTION_ORB_INITIAL_HOST,msgContext.getService());
if (orbInitialHost == null)
orbInitialHost = DEFAULT_ORB_INITIAL_HOST;
String orbInitialPort = getStrOption(OPTION_ORB_INITIAL_PORT,msgContext.getService());
if (orbInitialPort == null)
orbInitialPort = DEFAULT_ORB_INITIAL_PORT;
String nameId = getStrOption(OPTION_NAME_ID,msgContext.getService());
String nameKind = getStrOption(OPTION_NAME_KIND,msgContext.getService());
String helperClassName = getStrOption(OPTION_HELPER_CLASSNAME,msgContext.getService());
// Initialize ORB
Properties orbProps = new Properties();
orbProps.put("org.omg.CORBA.ORBInitialHost", orbInitialHost);
orbProps.put("org.omg.CORBA.ORBInitialPort", orbInitialPort);
ORB orb = ORB.init(new String[0], orbProps);
// Find the object
NamingContext root = NamingContextHelper.narrow(orb.resolve_initial_references("NameService"));
NameComponent nc = new NameComponent(nameId, nameKind);
NameComponent[] ncs = {nc};
org.omg.CORBA.Object corbaObject = root.resolve(ncs);
Class helperClass = ClassUtils.forName(helperClassName);
// Narrow the object reference
Method narrowMethod = helperClass.getMethod("narrow", CORBA_OBJECT_CLASS);
Object targetObject = narrowMethod.invoke(null, new Object[] {corbaObject});
return targetObject;