

13:38, EEST

January 19, 2017

Hallo,
I tried to load an xml model to the server address space. The model contains a variable which is an array of custom structure (Resolution2D).
The following xml contains the variable definition:
<UAVariable DataType=”Resolution2D” ParentNodeId=”ns=1;i=5018″ ValueRank=”1″ NodeId=”ns=1;i=6016″ ArrayDimensions=”2″ BrowseName=”2:Value” AccessLevel=”3″>
<DisplayName>Value</DisplayName>
<References>
<Reference ReferenceType=”HasModellingRule”>i=78</Reference>
<Reference ReferenceType=”HasTypeDefinition”>ns=3;i=2002</Reference>
<Reference ReferenceType=”HasComponent” IsForward=”false”>ns=1;i=5018</Reference>
</References>
<Value>
<uax:ListOfExtensionObject>
<uax:ExtensionObject>
<uax:TypeId>
<uax:Identifier>ns=3;i=5003</uax:Identifier>
</uax:TypeId>
<uax:Body>
<Resolution2D xmlns=”http://kuka.com/products/cameras/Types.xsd”>
<Name>
<Text xmlns=”http://opcfoundation.org/UA/2008/02/Types.xsd”>480p</Text>
</Name>
<Width>640</Width>
<Height>480</Height>
<ReolutionUnit>
<NamespaceUri xmlns=”http://opcfoundation.org/UA/2008/02/Types.xsd”></NamespaceUri>
<UnitId xmlns=”http://opcfoundation.org/UA/2008/02/Types.xsd”>0</UnitId>
<DisplayName xmlns=”http://opcfoundation.org/UA/2008/02/Types.xsd”>
<Text>pixel</Text>
</DisplayName>
<Description xmlns=”http://opcfoundation.org/UA/2008/02/Types.xsd”/>
</ReolutionUnit>
</Resolution2D>
</uax:Body>
</uax:ExtensionObject>
<uax:ExtensionObject>
<uax:TypeId>
<uax:Identifier>ns=3;i=5003</uax:Identifier>
</uax:TypeId>
<uax:Body>
<Resolution2D xmlns=”http://kuka.com/products/cameras/Types.xsd”>
<Name>
<Text xmlns=”http://opcfoundation.org/UA/2008/02/Types.xsd”>720p</Text>
</Name>
<Width>1280</Width>
<Height>720</Height>
<ReolutionUnit>
<NamespaceUri xmlns=”http://opcfoundation.org/UA/2008/02/Types.xsd”></NamespaceUri>
<UnitId xmlns=”http://opcfoundation.org/UA/2008/02/Types.xsd”>0</UnitId>
<DisplayName xmlns=”http://opcfoundation.org/UA/2008/02/Types.xsd”/>
<Description xmlns=”http://opcfoundation.org/UA/2008/02/Types.xsd”/>
</ReolutionUnit>
</Resolution2D>
</uax:Body>
</uax:ExtensionObject>
</uax:ListOfExtensionObject>
</Value>
</UAVariable>
The XML Parser is not capable of parsing the xml file and I get the following error:
Error in ModelParser2.endElement: localName=Valueorg.opcfoundation.ua.encoding.DecodingException: Bad_DecodingError (code=0x80070000, description=”Not an end element”) (near line 410)
at com.prosysopc.ua.ModelParserBase.parseFile(Unknown Source)
at com.prosysopc.ua.ModelParserBase.parseFile(Unknown Source)
at com.prosysopc.ua.server.NodeManagerTable.loadModel(Unknown Source)
at com.prosysopc.ua.server.NodeManagerTable.loadModel(Unknown Source)
at com.kuka.basys.CameraAAS.MainClass.main(MainClass.java:25)
Where’s the problem?
Thanks in advance.
Jacob Saoumi
17:44, EEST

January 19, 2017

Hi,
It seems that the XMLDecoder class has a bug. I replaced it in the classpath with the newest version from the OPCUA github Repository and it works.
Now I have another problem with code generator:
@Override
public void getEncodeable(IDecoder decoder, IEncodeable encodeable)
throws DecodingException {
Resolution2D result = (Resolution2D) encodeable;
super.getEncodeable(decoder, result);
result.setName(decoder.get(“Name”, String.class));
result.setWidth(decoder.get(“Width”, Integer.class));
result.setHeight(decoder.get(“Height”, Integer.class));
result.setResolutionUnit(decoder.get(“ResolutionUnit”, String.class));
}
the generated class calls the method (decoder.get(fieldName, class)) which returns null always.
11:33, EEST

December 21, 2011

16:10, EEST

April 3, 2012

Hi,
Actually, this should work with 2.3.2 already https://downloads.prosysopc.com/opcua/release_notes2.3.2-781.html (assuming the model is codegenerated, so that the serializers exists).
– Bjarne
Most Users Ever Online: 1919
Currently Online:
31 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: 801
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1539
Posts: 6496
Newest Members:
rebekahfortner3, Stevennox, qfpalfie08, brittny89u, LinwoodBup, isabellabeeton2, ladonnacdv, DarwinVew, betseymitford95, HowardtitModerators: Jouni Aro: 1028, Pyry: 1, Petri: 0, Bjarne Boström: 1037, Jimmy Ni: 26, Matti Siponen: 353, Lusetti: 0
Administrators: admin: 1