Avatar

Please consider registering
guest

sp_LogInOut Log In sp_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 RSS sp_TopicIcon
Bad_DecodingError (code=0x80070000, description="Cannot decode null") receiving an ExtensionObject
October 17, 2017
10:43, EEST
Avatar
in-fke
Member
Members
Forum Posts: 36
Member Since:
June 8, 2016
sp_UserOfflineSmall Offline

We are sill working on supporting Siemens S7-1500’s OPC UA Server. We are now stuck on decoding ExtensionObject. This should go along the lines of supporting the PLCopen namespace?

We have managed to reproduce with the following:
This is opc-ua-stack 1.02.337.12 and client 2.3.0-764 talking to Unifided Automations Demo CPP Server (uaservercpp-win32-x86-vs2010sp1-v1.5.5-355.zip).

We are getting the following exception from the stack:
2017-10-17 09:04:41,946 INFO binary.BinaryDecoder:? Failed to decode ExtensionObject: org.opcfoundation.ua.encoding.DecodingException: Bad_DecodingError (code=0x80070000, description=”Cannot decode null”)

We are trying to read the value from Objects.Demo.Static.Scalar.Structures.AnalogMeasurement –
We can read the ExtensionObjects properties typeId=nsu=http://www.unifiedautomation.com/DemoServer/;i=543214, encodeType=Binary and the object is a byte[]

the OPC UA Client “UAExpert” can read it – the Node AnalogMeasurement is of type AnalogMeasurementValue and some kind of “Switch Field”.

Obviously the OPC UA Stack does not know how to decode this type? Can we register something to achieve this? There should be some standard code to support the PLCOpen types?

We appreciate any feedback.

Stack is:
Daemon Thread [TcpConnection/Read] (Suspended (exception DecodingException))
EncodeableSerializer(SerializerComposition).getEncodeable(Class, IDecoder) line: not available
ExtensionObject.decode(IEncodeableSerializer, EncoderContext, NamespaceTable) line: not available
ExtensionObject.decode(EncoderContext, NamespaceTable) line: not available
EncoderContext.decode(ExtensionObject[], NamespaceTable) line: not available
EncoderContext.decode(ExtensionObject[]) line: not available
BinaryDecoder.getVariant(String) line: not available
BinaryDecoder.getDataValue(String) line: not available
BinaryDecoder.getDataValueArray(String) line: not available
EncodeableSerializer$121.getEncodeable(IDecoder) line: not available
EncodeableSerializer$121(AbstractSerializer).getEncodeable(Class, IDecoder) line: not available
EncodeableSerializer(SerializerComposition).getEncodeable(Class, IDecoder) line: not available
BinaryDecoder.getMessage() line: not available
TcpConnection$ReadThread.run() line: not available

October 17, 2017
12:12, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1032
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

The node in question has the the DataType of AnalogMeasurementValue, which is defined as a subtype of Union.

Unions were added to the UA specification version 1.03. Our SDK as the current release version (2.x) supports 1.02.

The future SDK versions 3.x will support UA 1.03 types. (We hope to release 3.0 before the end of this year, public beta hopefully sooner).

Note that other types that are defined in earlier versions do work.

– Bjarne

P.S. Also note that in general if you try to read any custom Structure, you need to codegen and register the model to the UaClient before reading. SDK 3 will offer some support for the DataTypeDictionary system to read custom structures without codegenerating the model (but it will be limited to normal Structures having fields of non-custom types).

October 17, 2017
19:38, EEST
Avatar
in-fke
Member
Members
Forum Posts: 36
Member Since:
June 8, 2016
sp_UserOfflineSmall Offline

Thanks for quick reply – as usual 😉

The test we made was only to “learn” about ExtensionObject and the concept of having an EncodeableSerializer.
What we try to achieve is to be able to talk to an OPC UA Server which obviously “speaks” PLCopen, so we wonder if this could be achieved with the current stack.
I dug through some source code, e.g.
https://github.com/OPCFoundation/UA-Java/blob/master/src/main/java/org/opcfoundation/ua/utils/StackUtils.java
and so I hit EncodeableSerializer which is code-generated (looks like what you mentioned).
Looking at the codegen stuff I wonder that noone is trying to add PLCopen stuff? Or am I barking up the wrong tree? Maybe there are some types specific to S7-1500 but we will have to check that.

Should it be possible to programmatically register types by expandedId via SerializerComposition.addSerializer() ?

October 18, 2017
10:58, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1032
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Well I replied to the error in question. But it should not matter if you are just trying to read PLCOpen related nodes.

Have you read the SDK tutorial found in the ‘doc’ folder and the Readmes found in ‘codegen’ folder, if not: please do.

PLCOpen is one of the models that is bundled with the SDK and already code-generated to the binaries.
Call the following methods before connecting and everything should work:

UaClient.registerModel(com.prosysopc.ua.types.di.client.InformationModel.MODEL)
UaClient.registerModel(com.prosysopc.ua.types.plc.client.InformationModel.MODEL)
(as the PLCOpen information model depends on the DI model, it must also be registered first, which dependens on the standadrd model, which is registered automatically).

Also read this blog post, https://prosysopc.com/blog/prosys-opc-ua-java-sdk-2.0-release-codegen/

– Bjarne

P.S.
The Stacks are maintained by the OPC Foundation. SDKs are usually built on top of the Stacks as is ours. However in practice while working with the SDK level, you should not concern yourself by the stack layer at all, unless instructed. Stack is a low-level api for handling the request/responses and the standard type serialization. Anything else is handled by the SDK layers. Technically the stack does have it’s own codegen, but it is not suited/designed for anything other than the standard namespace. The codegen I’m referring in previous post is the SDK codegen found in the ‘codegen’ folder of the SDK package.

October 30, 2017
15:26, EET
Avatar
in-fke
Member
Members
Forum Posts: 36
Member Since:
June 8, 2016
sp_UserOfflineSmall Offline

Hallo Bjarne,
thank you! After all my speculation, adding the mentioned code-generated models would be the simple answer to my question.
We would get these “unknown” objects when we subscribed to corresponding parent nodes in question e.g. subscribing to a whole function block.
We will now do some more testing with these models registered.

Regards,
Florian

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
24 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Heikki Tahvanainen: 402

hbrackel: 144

rocket science: 88

pramanj: 86

Francesco Zambon: 83

Ibrahim: 78

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

Member Stats:

Guest Posters: 0

Members: 730

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1529

Posts: 6471

Newest Members:

toneylapham544, rondawolinski7, Marypof5711, roycedelargie91, kourtneyquisenbe, ellis87832073466, zkxwilliemae, gabriellabachus, Deakin, KTP25Zof

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1032, Jimmy Ni: 26, Matti Siponen: 349, Lusetti: 0

Administrators: admin: 1