[omniORB] Callback problem

Andrew Parkin AndrewP@eigroup.com
Fri, 16 Feb 2001 14:58:24 -0000


Hi,

I don't know if anyone can throw any light on what I am doing wrong here.  I
am trying to pass a C++ object to a Corba server written in Java for it to
perform callbacks on, but I keep getting "Caught unknown exception".  I'm
not sure whether I am creating and using the callback object correctly, and
I tried compiling the supplied example which didn't work.  The IDL is below,
followed by the implementation of CorbaRemoteSMListener, then finally the
code used to pass the reference to the callback object.

Any help would be appreciated.  Thanks in advance.



/** SMS.IDL */
module sms
{
	struct MessageStruct
	{
		string body;
		string destNumber;
	};
	
	
	interface CorbaRemoteSMListener
	{
		void messageEvent();
		void statusEvent();
	};

	interface SMSCorba
	{
  		string submitMessageGetEvents(in MessageStruct msg, in
CorbaRemoteSMListener listener);
	};
};




/** IMPLEMENTATION OF CorbaRemoteSMListener */
class CorbaRemoteSMListenerImpl: sms::_impl_CorbaRemoteSMListener

{
	public:
		CorbaRemoteSMListenerImpl()
		{
			cerr << "Constructor called" << endl;
		}
		virtual omniObjRef* _do_get_interface()
		{
			cerr << "_do_get_interface() called" << endl;
			return 0;
		}
		virtual void messageEvent()
		{
			cerr << "Message event received" << endl;
		}
		virtual void statusEvent()
		{
			cerr << "Status event received" << endl;
		}
};




/** CODE TO PASS THE CALLBACK */
CorbaRemoteSMListenerImpl* corbaRemoteSMListenerImpl = new
CorbaRemoteSMListenerImpl();
CORBA::String_var ticketID = e->submitMessageGetEvents(msgStruct,
(sms::_objref_CorbaRemoteSMListener*)corbaRemoteSMListenerImpl);