[omniORB] Inout parameter - DII

Shanmugam Deveraj shm@transynergy.net
Mon, 25 Jun 2001 19:14:39 +0200


Hi

Can anyone throw some highlight on why inout parameter doesn't work in
the DII scenario? Is it not supposed to work? Any pointers please?.

Normal method call:- (This works)
	CORBA::String_var sParam = (const char *)"Nothing for now";
	CORBA::String_var sInput = (const char *)sInputBuf;
	CORBA::String_var sReturn;
	refObj->Execute(sParam,sInput,sReturn);

	cout << (const char *)sReturn; // contains the value set in
execute() method.

DII method call:-  (This does not work)
	CORBA::String_var sParam = (const char *)"Nothing for now";
	CORBA::String_var sInput = (const char *)sInputBuf;
	CORBA::String_var sReturn;

	CORBA::Request_var req;
	req = obj->_request("Execute");

	req->add_in_arg() <<= sParam;
	req->add_in_arg() <<= sInput;
	req->add_inout_arg() <<= sReturn;

	req->set_return_type(CORBA::_tc_boolean);

	req->invoke();

	if( req->env()->exception() ) {
		cerr << "Test : An exception was thrown while invoking a
corba method!" << endl;
		return;
	}
	cout << (const char *)sReturn;  // does not contain the value
set in execute() method.

I am able to get the 'sParam', 'sInput' values in Execute method. I am
also able to get 'sReturn' value in execute() but not the return value.

bool CMyObject::Execute(const char *sParam, const char *sInput, char
*&sReturn)
{
	...
	sReturn = CORBA::string_dup("Hi");
}

Regards,
Shanmugam.D.