Open Neil336 opened 1 year ago
I was able to get it to write to the server. From the Program.cs I can also get the value back and decode the bytes to the type. Both write and read have StatusCode Good. However, when using Softing OPC UA Client, I get "Message: Exception - Unexpected error processing response.: PUBLISH # 11 - Unhandled error during Publish. BadUnknownResponse 'Unexpected error processing response.'" and "Exception - Unable to read beyond the end of the stream.: Unexpected error processing response. EndOfStreamException 'Unable to read beyond the end of the stream.'" When using UaExpert I can see a long 0x number under Value->Value->Data, but Value->Value is labeled as UnknownExtensionObject. When double clicking on Value->Value->Data it shows "UaGenericStructureValue::setGenericValue returned BadTypeMismatch"
Type of issue
Current Behavior
To summarize: I can't write a custom datatype to the server, because I get a BadTypeMismatch.
In more detail: I tried to break the structure of the custom datatype down to a minimum and then read the value on the server and write it back directly. Using console output the value and datatype of the read and the written value are the exact same, but I get a BadTypeMismatch. Below I have listed some other approaches I have tried (I'm sorry for the huge text, but I hope I didn't miss anything important):
Additional info: Reading works fine, I can see the results in the Softing OPC UA Client or in the terminal (here as XML Element). The custom datatype variable has Access Level and User Access Level "CurrentRead, CurrentWrite" (3).
Code: In the following code I changed the TypeName, FieldName and NodeIds to symbolic names.
From the Program.cs code:
Additionally, here are the Variable and Type definition:
Thank you for your help :)
Expected Behavior
The behavior I expect is to be able to write to a custom datatype on the server, or at least to it's fields. In the end I would have more fields including nested structures.
Steps To Reproduce
No response
Environment
Anything else?
I also tried various different approaches:
1) creating a class in C# which extends EncodableObject with the field and the following functions:
a) here I then first tried something similar to https://github.com/OPCFoundation/UA-.NETStandard/issues/790 (the constructor creates new instance with FieldName initializes to 0):
b) Then I thought I might need to make use of the Encoding, thus I changed it to:
c) I also tried to manually recreating the value:
2) In a different approach I tried to change the XML file to include HasComponent in the hopes that I can change the components (which then are regular types). However, in the end I was able to adjust the components (the fields), but the change was not reflected in the value of the parent. The XML now looks like this:
3) using the following functions yield no types: