![Avatar](https://opcfoundation.org/wp-content/uploads/sp-resources/forum-avatars/defaults/userdefault.png)
03/06/2024
![sp_UserOfflineSmall](https://opcfoundation.org/wp-content/sp-resources/forum-themes/reboot/images/darkpack/sp_UserOfflineSmall.png)
Hello,
Hello, I have an Opc client, when I read the node is ExtensionObject.
the node is custom structure in Opc Ua Server PLC siemens 1500.
the value is systematically encoded as a byte.
In the example provided, the node is read with an Xml encoding.
I tried to specify to the client not to use the Binary encoding with :
'
ConfiguredEndpoint endpoint = new ConfiguredEndpoint(null, endpointDescription, endpointConfiguration);
endpoint.Configuration.UseBinaryEncoding = false;
'
This changes nothing.
I Have try this:
DataValue value = _session.ReadValue(nodeId);
ExtensionObject extObject = (ExtensionObject)value.Value;
var Decoder = new BinaryDecoder(extObject.Body as Byte[], ServiceMessageContext.GlobalContext);
var Result = Decoder.ReadXmlElement(null);
return value;
Exception :MaxByteStringLength 1048560 < 54657037
Do you have any idea what I might have missed?
Thanks in advance.
Best regards.
![Avatar](https://opcfoundation.org/wp-content/uploads/sp-resources/forum-avatars/defaults/admindefault.png)
05/30/2017
![sp_UserOfflineSmall](https://opcfoundation.org/wp-content/sp-resources/forum-themes/reboot/images/darkpack/sp_UserOfflineSmall.png)
endpoint.Configuration.UseBinaryEncoding only works of the protocol allows XML (i.e. http).
It has no effect if using opc.tcp
You can, in theory, read an alternate encoding by setting the DataEncoding in the ReadValueId when reading a value.
However, this only works if the Server supports conversions for that particular Variable.
The right way to deal with these unknown types is to use the Generic structure class that are part of the .NET Codebase:
https://github.com/OPCFoundati.....mplexTypes
Samples of using these classes are part of the Reference server.
![Avatar](https://opcfoundation.org/wp-content/uploads/sp-resources/forum-avatars/defaults/userdefault.png)
03/06/2024
![sp_UserOfflineSmall](https://opcfoundation.org/wp-content/sp-resources/forum-themes/reboot/images/darkpack/sp_UserOfflineSmall.png)
Hello , Thank you for your Help !
I didn't have install the nuget OPCFoundation.NetStandard.Opc.Ua.Client.ComplexTypes.
I added this to my server connection and the objects are now decoded, so I can watch them being processed and written.
ComplexTypeSystem complexTypeSystem = new ComplexTypeSystem(_session);
complexTypeSystem.Load().Wait();
Cdt.
1 Guest(s)