Avatar
Please consider registering
guest
sp_LogInOut Log Insp_Registration Register
Register | Lost password?
Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Feed Topic RSSsp_TopicIcon
Bad_DecodingError (0x80070000) "Decoding halted because of invalid data in the stream."
April 10, 2026
16:43, EEST
Avatar
devaskim
Member
Members
Forum Posts: 7
Member Since:
February 29, 2024
sp_UserOfflineSmall Offline

Hi Team,

In our OPC UA server we have tag with the array of ExtensionObject. UAExpert client displays each array element as 3 number fileds (Min, Max and Status).
But our client based on 4.8.0 Prosys Java SDK throws an exception with the following information:

StatusCode: Bad_DecodingError (0x80070000) “Decoding halted because of invalid data in the stream.”
Detailed Message: Unknown encoding: urn:localhost:opcua:demo-server:1004

To decode we use the following code:

DataValue dataValue = ……;
uaClient.getTypeDictionary().decode(dataValue.getValue().getValue()[0]);

Any thoughts how to fix this?

April 13, 2026
10:03, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1114
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

Does it work with our https://prosysopc.com/products…..a-browser/?

If yes, then most likely you can fix the issue by updating the SDK. The version 4.8.0 is almost 4 years old. Latest version is 5.6.2 as of writing. If no, then a fix would be based on the latest version.

By default UaClient.connect will read type data from the server and will automatically decode ExtensionObjects to Structures. In most cases manual decoding does nothing, if the automatic one fails, though it will tell a cause. The “Unknown encoding: urn:localhost:opcua:demo-server:1004” in 4.x tells that it received an ExtensionObject of a type that for it doesn’t have the data to decode it. The current versions would also check for the server if a type was added after the connection was made (assuming the server supports OPC UA 1.04 DataTypeDefinition). Also the decoding system is a bit different in 5.x,

April 13, 2026
11:40, EEST
Avatar
devaskim
Member
Members
Forum Posts: 7
Member Since:
February 29, 2024
sp_UserOfflineSmall Offline

Thanks for the answer, Bjarne,

Here is the output of Prosys OPC UA Browser. Almost the same data representation I observed while debugging our Java client.

“Received Value with Good StatusCode: GOOD (0x00000000)
“”The operation succeeded.””” 0 ns=1;i=1005 Item UDT_RANGE
“[ExtensionObject [typeId=nsu=urn:localhost:opcua:demo-server;i=1004, encodeType=Binary, object=[6] 0x000000000000],
ExtensionObject [typeId=nsu=urn:localhost:opcua:demo-server;i=1004, encodeType=Binary, object=[6] 0x000000000000],
ExtensionObject [typeId=nsu=urn:localhost:opcua:demo-server;i=1004, encodeType=Binary, object=[6] 0x000000000000],
ExtensionObject [typeId=nsu=urn:localhost:opcua:demo-server;i=1004, encodeType=Binary, object=[6] 0x000000000000],
ExtensionObject [typeId=nsu=urn:localhost:opcua:demo-server;i=1004, encodeType=Binary, object=[6] 0x000000000000],
ExtensionObject [typeId=nsu=urn:localhost:opcua:demo-server;i=1004, encodeType=Binary, object=[6] 0x000000000000],
ExtensionObject [typeId=nsu=urn:localhost:opcua:demo-server;i=1004, encodeType=Binary, object=[6] 0x000000000000],
ExtensionObject [typeId=nsu=urn:localhost:opcua:demo-server;i=1004, encodeType=Binary, object=[6] 0x000000000000],
ExtensionObject [typeId=nsu=urn:localhost:opcua:demo-server;i=1004, encodeType=Binary, object=[6] 0x000000000000],
ExtensionObject [typeId=nsu=urn:localhost:opcua:demo-server;i=1004, encodeType=Binary, object=[6] 0x000000000000]]”
“04/13/26 12:46:42.1929379” “04/13/26 12:46:42.1929379” “GOOD (0x00000000) “”The operation succeeded.”””

If I try to write to this tag, Prosys OPC UA Browser doesn’t show me the members of each array item. Instead, the output is the following

Item DataType Value
[0] UDT_RANGE [0]
……………………………………………..
[9] UDT_RANGE [9]

As I mentioned before, UA Expert lets edit inner members (Min, Max, Status) of each array item.

Unfortunately, I cannot provide any server configuration, but we can reproduce the issue with simple JS (NodeJS) script using node-opcua library. If needed, I can share it with you.

April 13, 2026
12:48, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1114
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

That would indicate there is some issue that they wont get decoded, thus Browser basically knows nothing about them. Thus, there is some issue in the latest SDK or with the server in a way that it works with UaExpert (this sometimes happens if there is more than one path to solution). Or (though unlikely here) it could be that there is some feature of OPC UA being used that we do not support yet (some abstract types were semi-recently allowed as Structure fields, though your ‘object=[6] 0x000000000000’ rules that out as Variant form would be used in the data and it would cause non-0 output).

Is it possible to navigate to your Structure DataType (assuming named UDT_RANGE, based on the output), below Types/DataTypes/BaseDataType/Structure/, and show the value of the DataTypeDefinition Attribute, it should look something like this (/Root/Types/DataTypes/BaseDataType/Structure/AxisInformation):
StructureDefinition [DefaultEncodingId=”i=12089″, BaseDataType=”i=22″, StructureType=”Structure”, Fields=”[StructureField [Name=”EngineeringUnits”, Description=””, DataType=”i=887″, ValueRank=”-1″, ArrayDimensions=”null”, MaxStringLength=”0″, IsOptional=”false”], StructureField [Name=”EURange”, Description=””, DataType=”i=884″, ValueRank=”-1″, ArrayDimensions=”null”, MaxStringLength=”0″, IsOptional=”false”], StructureField [Name=”Title”, Description=””, DataType=”i=21″, ValueRank=”-1″, ArrayDimensions=”null”, MaxStringLength=”0″, IsOptional=”false”], StructureField [Name=”AxisScaleType”, Description=””, DataType=”i=12077″, ValueRank=”-1″, ArrayDimensions=”null”, MaxStringLength=”0″, IsOptional=”false”], StructureField [Name=”AxisSteps”, Description=””, DataType=”i=11″, ValueRank=”1″, ArrayDimensions=”[0]”, MaxStringLength=”0″, IsOptional=”false”]]”].

It is possible that it shows Bad_AttributeIdInvalid (0x80350000) “The attribute is not supported for the specified Node.”, then it would mean it uses an older DataTypeDictionary system, though explaining that is a bit more complicated, thus best if you send email to jsdk-support@prosysopc.com if that happens (include the node-opcua script, though I cannot promise we would look that).

P.S.
While viewing the DataType node, in the Attribute and References, for the References, you should see forward HasEncoding Reference whose target is “Default Binary”, if you expand that tree-table-view node, it should show a NodeId in a namespaceindex that is equivalent to the nsu=urn:localhost:opcua:demo-server, can you see the NamespaceUri if you expand the NodeId, and the value part should be i=1004. That is the value being transmitted in the ExtensionObject and used to link it to the Structure type (and then the DataTypeDefinition tells how to decode it).

April 13, 2026
15:49, EEST
Avatar
devaskim
Member
Members
Forum Posts: 7
Member Since:
February 29, 2024
sp_UserOfflineSmall Offline

Here is output of our DataType using Prosys OPC UA Browser

DataTypeDefinition StructureDefinition [DefaultEncodingId=”ns=1;i=1004″, BaseDataType=”i=22″, StructureType=”Structure”, Fields=”[
StructureField [Name=”Max”, Description=””, DataType=”i=5″, ValueRank=”0″, ArrayDimensions=”[]”, MaxStringLength=”0″, IsOptional=”false”],
StructureField [Name=”Min”, Description=””, DataType=”i=5″, ValueRank=”0″, ArrayDimensions=”[]”, MaxStringLength=”0″, IsOptional=”false”],
StructureField [Name=”Status”, Description=””, DataType=”i=5″, ValueRank=”0″, ArrayDimensions=”[]”, MaxStringLength=”0″, IsOptional=”false”]]”]

Bad_AttributeIdInvalid error are only in RolePermissions, UserRolePermissions and AccessRestrictions attributes.

April 13, 2026
16:20, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1114
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

That does explain. The ValueRanks are incorrect, they should be -1, not 0. See https://reference.opcfoundatio…../docs/8.51 “ValueRank Int32 The value rank for the field. It shall be Scalar (-1) or a fixed rank Array (>=1).”. In OPC UA the ValueRank is a bit … compliacted, but it is the number of dimensions when 1+, but 0 and some negative numbers have special meaning, see Variable NodeClass as an Attribute, see https://reference.opcfoundatio…..5/docs/5.6. However, Structures need fixed number of things (so scalar or fixed known dimension), at least so far.

So, basically our parser will ignore this DataType as the definition is incorrect, thus later decodings will also fail. If you can correct this on the server or ask the maintainers of it to correct it should start to work. Possibly UaExpert has done the check in a way that incorrectly allows 0 to work (such as scalar).

April 13, 2026
16:48, EEST
Avatar
devaskim
Member
Members
Forum Posts: 7
Member Since:
February 29, 2024
sp_UserOfflineSmall Offline

Many thanks, Bjarne!
After fixing definition the issue is gone and data is deserialized to DynamicStructure object.
Last question: is there any example how to deal with such objects in Java?

April 13, 2026
17:38, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1114
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

First a note that this topic is somewhat complicated. Also, this answer is based on the 5.x. Though, it is mostly the same in 4.x.

When dealing with Structures for which you do not know the exact type in code, it is best to treat them as the raw ‘Structure’ interface. It does have methods for getting and setting fields in a generic way, see https://documentation.prosysop…..cture.html. Alternatively for known types for which you do have an information model NodeSet XML file, you could use the included Codegen tool to create java classes that represent the Structures.

The SDK has special metadata classes StructureSpecification and FieldSpecification that model the Structure types that they can be handled in a generic way. Nowadays, you could mostly think them as “better versions” of StructureDefinition and FieldDefinition from the DataTypeDefinition Attribute, though StructureSpecification and FieldSpecification do pre-date them. Basically they were first used with what we now call legacy DataTypeDictionaries (the server has a node that has a big XML document). Now depending what the server supports we either use the DataTypeDefinition Attribute or the legacy dictionaries (or both), but the “SDK user API” is still the same with StructureSpecification and FieldSpecification regardless of which one was used.

See
https://documentation.prosysop…..ation.html
https://documentation.prosysop…..ation.html
you can use com.prosysopc.ua.stack.builtintypes.Structure.specification() to get the StructureSpecification and then getFields on that to get FieldSpecification, one per each field, these tell e.g. the field name and datatype which helps when using e.g. com.prosysopc.ua.stack.builtintypes.Structure.set(String, Object).

If you do not have any Structure instance to .specification(), you can use com.prosysopc.ua.client.UaClient.getEncoderContext()+ com.prosysopc.ua.stack.encoding.EncoderContext.getStructureSpecification(UaNodeId) to get the StructureSpecification of that type, then com.prosysopc.ua.typedictionary.StructureSpecification.toInstanceBuilder() will give a Structure.Builder that can be used to build the Structure instances of that type.

In 5.x the concept was generalized in a way all datatypes, in 4.x it is mostly just Structures and Enumerations (https://downloads.prosysopc.co…..sion-5-0-0)

We should probably improve the documentation at some point, maybe the best existing example is in the SampleConsoleServer example com.prosysopc.ua.samples.server.MyNodeManager.createCustomStructure(), https://documentation.prosysop…..l#line.415. Though start around https://documentation.prosysop…..l#line.467 as the start of the method is creating the type itself.

Forum Timezone: Europe/Helsinki
Most Users Ever Online: 1919
Currently Online:
Guest(s) 29
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 149
rocket science: 128
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 912
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1599
Posts: 6757
Newest Members:
DrMatthiasArnold, hbf, AlbertPycle, issacwilloughby, Knut, morrisvqd188879, heathdallachy85, dewittfrantz2, devonkeenan47, chnmrc
Moderators: Jouni Aro: 1059, Pyry: 1, Petri: 1, Bjarne Boström: 1106, Jimmy Ni: 26, Matti Siponen: 372, Lusetti: 1
Administrators: admin: 1