For some reason I am unable to send an object with JavaScript from the client to the server with an enum as property of the object.
The enum and object:
<Structs>
<Struct Name="ObjectWithEnum" UID="{9718B71E-E410-4B26-A1E6-426159BF519B}" AutoCreateParams="1">
<Elements>
<Element Name="UpdateState" DataType="UpdateState">
</Element>
</Elements>
</Struct>
</Structs>
<Enums>
<Enum Name="UpdateState" UID="{5BAB5938-1925-417F-9FDF-D9290F3310CF}">
<EnumValues>
<EnumValue Name="None">
</EnumValue>
<EnumValue Name="Modified">
</EnumValue>
<EnumValue Name="Inserted">
</EnumValue>
<EnumValue Name="Deleted">
</EnumValue>
</EnumValues>
</Enum>
</Enums>
The method is defined as follows:
<Operation Name="GetObjectWithEnum" UID="{E4E0916F-3C80-4DC2-85C1-51F743741F67}">
<Parameters>
<Parameter Name="ObjectWithEnum" DataType="ObjectWithEnum" Flag="In" >
</Parameter>
</Parameters>
</Operation>
Calling the GetObjectWithEnum function results in a Error: BinMessage.write: Unknown type of - undefined on the client.
Server (Remoting SDK Server, RODL-based(.NET Core):
Server.zip (638.6 KB)
Client (ASP.NET Core Web App):
Client.zip (1.2 MB)
antonk
(antonk)
October 15, 2021, 1:28pm
3
Hello
You need to use syntax like
var objectWithEnum = new Server.ObjectWithEnum();
objectWithEnum.fromObject({ UpdateState: new Server.UpdateState()});
objectWithEnum.UpdateState.value.value = "Modified";
Regards
Hello thank you for your reply.
This time the error: “Uncaught TypeError: Cannot read properties of undefined (reading ‘ExtraInfo’)” occured when I tried sending an object to the server which has a object, a string and an enum as property.
The object property has 2 properties of itself, a string and an enum as described below:
<Structs>
<Struct Name="ObjectWithEnum" UID="{9718B71E-E410-4B26-A1E6-426159BF519B}" AutoCreateParams="1">
<Elements>
<Element Name="UpdateState" DataType="UpdateState">
</Element>
<Element Name="ExtraInfo" DataType="WideString">
</Element>
</Elements>
</Struct>
<Struct Name="ObjectWithProps" UID="{16F5E8A2-B53B-422A-AFF8-C8FDF1EF4369}" AutoCreateParams="1">
<Elements>
<Element Name="ObjectWithEnum" DataType="ObjectWithEnum">
</Element>
<Element Name="SpaceType" DataType="SpaceType">
</Element>
<Element Name="Name" DataType="WideString">
</Element>
</Elements>
</Struct>
</Structs>
<Enums>
<Enum Name="UpdateState" UID="{5BAB5938-1925-417F-9FDF-D9290F3310CF}">
<EnumValues>
<EnumValue Name="None">
</EnumValue>
<EnumValue Name="Modified">
</EnumValue>
<EnumValue Name="Inserted">
</EnumValue>
<EnumValue Name="Deleted">
</EnumValue>
</EnumValues>
</Enum>
<Enum Name="SpaceType" UID="{0A4A6A8A-FDF0-4534-BB33-0BB8FBBB6299}">
<EnumValues>
<EnumValue Name="NormalSpace">
</EnumValue>
<EnumValue Name="SpecialSpace">
</EnumValue>
</EnumValues>
</Enum>
</Enums>
I tried creating the object with the syntax below:
var objectWithEnum = new Server.ObjectWithEnum();
objectWithEnum.fromObject({
UpdateState: new Server.UpdateState(),
ExtraInfo: "New"
});
objectWithEnum.UpdateState.value.value = "Modified";
var objectWithProps = new Server.ObjectWithProps();
objectWithProps.fromObject({
SpaceType: new Server.SpaceType(),
Name: "John Doe"
});
objectWithProps.ObjectWithEnum.value = objectWithEnum;
objectWithProps.SpaceType.value.value = "NormalSpace";
Any ideas on solving this problem?
Server (Remoting SDK Server, RODL-based(.NET Core):
Server.zip (646.8 KB)
Client (ASP.NET Core Web App):
Client.zip (1.2 MB)
Regards
antonk
(antonk)
October 25, 2021, 11:10am
6
Hello
It seems there was an issue in the .fromObject
method implementation in some cases. Please send a mail to support@ and we’ll provide you updated RemotingSDK.js file
bugs://D19175 was closed as fixed.
We’ve send an email.
Thank you Team, for such quick help!