[omniORB] DII and struct as operation argument

Smits, Martin martin.smits at task24.nl
Wed Jul 22 11:36:31 BST 2009


Hi all

I am trying to write a truly dynamic client using DII which talks to a server that is using the IDL generated header and stubs.
I do this because I will ultimately not be in control of the functions in the API implemented by the server (the client is some kind of engine processing an interpreted language which can construct objects to represent calls to the server. So the input 'script' and the server are the only ones that depend on changes in the API and I don't want to recompile the client engine each time the API changes).
Currently the client doesn't use an IFR to retrieve the API operation signatures, but that will be my next step.
Still I am having a problem with this situation and am unclear how to handle passing structs to the operations correctly.

What I have done so far...
The IDL:
interface Complex {
  struct add_info {
    long count;
    sequence<long> item_list;
  };

  long add(in add_info input);
}

On the client side:

-          Create the _request("add")

-          Create the TypeCode for the item_list sequence and the add_info struct

-          Create DynamicAnys for the item_list and add_info from the TypeCodes

-          Fill in the values of all the fields

-          Convert the DynamicAny to an Any

-          Use add_in_arg("input") to add the Any as argument

-          Set the return type for the request

-          Call invoke() to call the server-side function
On the server side (using the generated files from the IDL):

-          Implement the virtual function which takes an 'const Complex::add_info&' as parameter

When I run the server and client program, I see an MARSHAL_SequenceIsTooLong exception thrown on the server and propagate to the client.

Running with ORBtraceLevel=40 shows that the client includes the complete TypeCode in the GIOP that goes to the server for the add() call. When I use a non-DII client program (which uses the header and stub generated from the IDL) I see that this TypeCode info is not sent to the server as part of the add() call.

What am I doing wrong here?

Some further experimenting shows two working solutions which I am not happy with (and kind of defeat the purpose of using CORBA/DII).

1.       Using the Any type in the parameter list of the add() operation in the IDL, like 'long add(in Any unput)'
The problem with this is, that when I want to load the IDL in the IFR (in the future) and retrieve the operation signature, I can't see that the actual argument I have to generate is to be of the type add_info.

2.       Using the following IDL: 'long add(in CORBA::TypeCode tc, in add_info input)'
Then in the server I just ignore the TypeCode parameter. I can't believe this is the OK way to handle this as it is way ugly.

Can someone enlighten me on this issue?

Greetings,
--
  Martin Smits
  E-Mail: Martin.Smits at task24.nl

Progress isn't made by early risers. It's made by lazy men trying to find
easier ways to do something.
  - Robert Heinlein

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20090722/5ec19172/attachment.htm


More information about the omniORB-list mailing list