out parameter problem?????
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sachin_Dare
Posted On:   Wednesday, December 22, 2004 07:59 AM

I am trying to use out parameter in CORBA,I have a method as void newMethod(out short msg); //in .idl file and in implementation I defined it as public void newMethod (org.omg.CORBA.ShortHolder msg) { msg.value = 100; } now when I try to use this method as ShortHolder sh = new ShortHolder((short)50); helloRef.newMethod(sh); System.out.println(sh.value); it gives me 0 (zero) output. I am using jdk1.4 to run this and -oldImplBase as flag to idlj Guru's requested to comment on this, Regards, Sachin Dare.    More>>

I am trying to use out parameter in CORBA,I have a method as

void newMethod(out short msg); //in .idl file

and in implementation I defined it as


public void newMethod (org.omg.CORBA.ShortHolder msg)
{
msg.value = 100;
}

now when I try to use this method as


ShortHolder sh = new ShortHolder((short)50);
helloRef.newMethod(sh); System.out.println(sh.value);



it gives me 0 (zero) output. I am using jdk1.4 to run this and -oldImplBase as flag to idlj

Guru's requested to comment on this,

Regards,
Sachin Dare.

   <<Less

Re: out parameter problem?????

Posted By:   Anonymous  
Posted On:   Tuesday, January 4, 2005 11:27 AM

Except that you are sending an argument as well as getting a response, and therefore should use either and inout parameter or add an in parameter, the code seems correct. Perhaps you should post the actual code.


Further, although I do see that Sun uses out parameters in their example code, it is preferable (according to Henning and Vinoski) to simply return the value from the operation instead of as an out parameter, i.e. your idl would be something like this:


short newMethod(in short msg);


I am using jdk1.4 to run this and -oldImplBase as flag to idlj


Are you sure you need to use this flag? Aren't you using JDK 1.4for the server?


Guru's requested to comment on this


Try comp.object.corba, this is a very good list which CORBA guru's read.

About | Sitemap | Contact