Topic RSS13:38, EEST
January 19, 2017
OfflineHallo,
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
OfflineHi,
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
Offline16:10, EEST
April 3, 2012
OfflineHi,
Actually, this should work with 2.3.2 already https://downloads.prosysopc.co…..2-781.html (assuming the model is codegenerated, so that the serializers exists).
– Bjarne

Log In
Register