I have a service call that takes a struct as one of its parameters.
The parameter is kind of optional so sometimes I’d like to set it to null.
When I do this in JavaScript I get the following error:
"Error: BinMessage.write: Unknown type of CustomerInformation - TrecCustomer"
It seems like on the client side the library is not able to appropriately serialize the null value.
Is it possible for the JavaScript client library to pass a null value for a struct parameter and if so can you tell me how to achieve that?
Thanks in advance!
here’s the fix - replace the beginning of RemObjects.SDK.BinMessage.prototype.write with:
RemObjects.SDK.BinMessage.prototype.write = function write(aName, aType, aValue) {
if (RemObjects.SDK.RTTI[aType]) {
if (aValue instanceof RemObjects.SDK.ROComplexType) { //not null
if (!(aValue instanceof RemObjects.SDK.ROEnumType)) {
this.fRequestObject += this.parser.encodeInt(1, 8, false);
if (aValue instanceof RemObjects.SDK.ROStructType)
this.writeStrWithLength(aType);
if (aValue instanceof RemObjects.SDK.ROArrayType)
this.fRequestObject += this.parser.encodeInt(aValue.items.length, 32, false);
};
aValue.writeTo(this);
} else { //null
if (!(RemObjects.SDK.RTTI[aType].prototype instanceof RemObjects.SDK.ROEnumType)) {
this.fRequestObject += this.parser.encodeInt(0, 8, false);
if (RemObjects.SDK.RTTI[aType].prototype instanceof RemObjects.SDK.ROStructType)
this.writeStrWithLength(aType);
};
};
} else
switch (aType) {