Hello,
I'm running into some touble while transforming data using the the RTI Router.
Basically, I have a type (let's call it NetworkEntity) which contains a single field (called "entity") of a complex type (let's call it InnerEntity) which contains primitives. The Router seems to have a problem accessing the members of the complex type (InnerEntity).
I used the example transformation library as a template, and the following code is taken from the createOutputSample method (I removed the error checking blocks for convenience):
output = DDS_DynamicData_new(self->networkType, &dynamicDataProps);
DDS_DynamicData_get_member_type(output,&innerEntityType,"entity",DDS_DYNAMIC_DATA_MEMBER_ID_UNSPECIFIED);
innerEntity = DDS_DynamicData_new(innerEntityType, &dynamicDataProps);
DDS_DynamicData_bind_complex_member(output,innerEntity,"entity",DDS_DYNAMIC_DATA_MEMBER_ID_UNSPECIFIED);
DDS_DynamicData_set_boolean(innerEntity, "someBoolean", DDS_DYNAMIC_DATA_MEMBER_ID_UNSPECIFIED, DDS_BOOLEAN_FALSE);
DDS_DynamicData_unbind_complex_member(output, innerEntity);
The Router spits out this error:
DDS_DynamicDataUtility_skip_compact_type:stream error trying to access string
DDS_DynamicDataUtility_skip_compact_type:stream error trying to access member name in type <the type's full name>
If I comment out the set_boolean call it's still happening, so the problem is with the bounding. My initial doubt was that the type of InnerEntity is not recognized by the Router, however using "innerEntityType" I managed to print the field names of InnerEntiy, so that's out of the window.
I would greatly appreciate some help regarding this matter.
Thanks,
Michael.
Hi Michael,
Ok let's take a look to the issue. First of all, the error messages do not seem to come from a RS failure but from a dyynamic data failure, so we can discard RS as the error cause. Nevertheless you're on right track pointing that the problem may reside on the bind operation. The probem is that the bound
DynamicData
object has already a type bound, which is incorrect. If we go to the documentation for the DDS_DynamicData_bind_complex_member operation we see the following:where in our case, the
toBeBound
object is theinnerEntity
, which already has a type bound hence causing the error. In fact I would expect an error after the bind operation (I don't know how the complete stack trace looks like, but it should show that is failing at that point). Otherwise we would need to review code returned by the bind operation).So what we have to do is to create an untyped
DynamicData
object as the innerEntity, The way to do this is by passing aNULL
type code. Therefore your code should look as folows:With these changes the problem should go away :). Let me know what you get.
Antonio
Hi Antonio,
I made the change you suggested, however the error persists.
Edit:
I also included an archive file containing all the files needed to recreate the problem (contains different types but it's all the same).
Hi Michael,
Thanks for the files. I've been able to reproduce it. After some research the only I can tell you is that the problem is not due to Routing Service nor Transformation but to DynamicData serialization. You can check that by creating publisher and subscriber in the same domain, and the error keeps showing.
I will keep looking for a workaround but this looks like an internal type serializtion issue.
Antonio
Hello Michael,
I agree with Antonio. The problem seems to be in the DynamicData itself.
I have tried to reproduce it. However the RAR you attached does not seem to contain all the necessary files to generate all the Java code from the IDL. For example I did not find the IDL file that corresponds to the NetworkTrack type. I wanted to re-generate the code because I am using a different version of the RTI core libraries and it may affect the generated output...
Short of re-generating from the IDL what I did was create some simple examples of nested types to see if I could reproduce it in a simpler situation. For example I used the type:
And built a routing service transformation that binds to the inner structure and sets the different "d" attributes. I based the transformation on your code and modified it as Antonio suggested (see attached testtransf.c). This worked without errors.
I know you are also working with support so perhaps you already have a diagnosis/answer... However, if you are still having trouble and you are able to post here an example with all the IDL files needed to generate the corresponding classes I could take another look...
Gerardo