Does anyone have some suggestions on how to handle determining on the Reply side what variables have actually been set in the message? I know I could possibly have defaults to expect, but that is not optimal because I will not always know the appropriate defaults. Just to clarify, I would like the Reply side to be aware of what variables in the received message were actually filled out by the requester. Any help is greatly appreciated.
Hi,
What does your "request" type look like? What programming language(s) are you using on the Requester side and the Replier side?
One way to do this is to define a data-type for yoru request that has optional members. For example:
When you do that the mapping to the programming language (e.g. C++) will be such that you will be able to set or not set the member. For example in C/C++ optional members will become pointers as in:
Note how the
MyRequestType
memberslong_data
andnested
are declared as pointers. If the requester does not want to set something. It should just set the member to NULL (this is for C or the traditional C++ language, other languages may do it differently by a similar mechanism is there). Then the Reply side will see those members set to NULL and know they were not set.Gerardo
Gerardo,
That is exactly what I was looking for. Thank you for taking the time to explain the solution.
Hi.
How can struct IDL to make reques-reply in Java application where can the requester request byte[] and the replier will reply same the size of the data byte[]?
I did like this, but i faced a problem to convert ByteSeq to byte[], If there is any good way to request byte[] and the replier will reply same data size and type byte[], please.
........
struct Request {
octet n[8];
};
struct Reply {
sequence<octet, 2000> rqrp;
};
........
Br
Bani.
Hi
How can struct IDL to make reques-reply Java application where can the requester request byte[] and the replier will reply same the data size and type byte[]?
I did like this, but i faced a problem, i can not convert ByteSeq to byte[], please, if there is good and easy way to struct IDL?
Thanks
Hi,
If you know the length of the Reply byte array ahead of time (like you did for the request), then you could define the Reply type with an array as well (instead of a sequence as in:
However this assumes the reply is always the same fixed size which given you want to copy the request it also implies the requests must also be the same fixed size... If you do not want this then the reply should be a sequence which has a variable length and can be adjusted each reply to match the length of the request. In this case once you get the ByteSeq on the reply you can use the ByteSeq.toArrayByte() operation to convert it to a byte[].
Gerardo