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
Base64 decoding error (wrong character) when registering nodeset.xml
June 27, 2017
9:02, EEST
Avatar
hbrackel
Member
Members
Forum Posts: 135
Member Since:
February 21, 2014
sp_UserOfflineSmall Offline

Good morning,
When registering a custom nodeset with a Java UaServer, the nodeset containing a struct dataType and variable of that type, an error occurs telling that there were incorrect characters in the Base64 sections. Java Code generation worked okay from the same nodeset and a different .NET based server can register the nodeset okay. The nodeset has been generated from UaModeler (latest version)
The Java SDK version is 2.3.2

Do you have any suggestions of how to work around this problem?

Thanks, Hans-Uwe

June 27, 2017
10:54, EEST
Avatar
hbrackel
Member
Members
Forum Posts: 135
Member Since:
February 21, 2014
sp_UserOfflineSmall Offline

Some additional information/correction:
1) the error happens when loading the nodeset (addressSpace.loadModel(…)), not when registering it
2) the concrete error is
09:50:35.441 [main] WARN com.prosysopc.ua.ModelParserBase – createModel: Error in ModelParser2.endElement: localName=Value
org.bouncycastle.util.encoders.DecoderException: unable to decode base64 string: invalid characters encountered in base64 data
at org.bouncycastle.util.encoders.Base64.decode(Unknown Source)
at org.opcfoundation.ua.transport.security.BcCryptoProvider.base64Decode(BcCryptoProvider.java:64)
at org.opcfoundation.ua.utils.CryptoUtil.base64Decode(CryptoUtil.java:120)
at org.opcfoundation.ua.encoding.xml.XmlDecoder.getByteString(XmlDecoder.java:474)
at org.opcfoundation.ua.encoding.xml.XmlDecoder.getVariantContents(XmlDecoder.java:2411)
at org.opcfoundation.ua.encoding.xml.XmlDecoder.getVariant(XmlDecoder.java:2282)
at com.prosysopc.ua.ModelParserBase.finalizeValue(ModelParserBase.java:881)
at com.prosysopc.ua.ModelParserBase.endElement(ModelParserBase.java:1467)
at com.prosysopc.ua.ModelParserBase$ModelHandler.endElement(ModelParserBase.java:113)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2967)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.prosysopc.ua.ModelParserBase.parseFile(ModelParserBase.java:388)
at com.prosysopc.ua.ModelParserBase.parseFile(ModelParserBase.java:344)
at com.prosysopc.ua.ModelParserBase.parseFile(ModelParserBase.java:414)
at com.prosysopc.ua.server.NodeManagerTable.loadModel(NodeManagerTable.java:2090)
at com.prosysopc.ua.server.NodeManagerTable.loadModel(NodeManagerTable.java:2050)

3) I extracted and based64-decoded the same data without any problems using Base64.getDecoder().decode(base64EncodedText)

June 27, 2017
11:04, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 983
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

If possible, can you paste the base64 string in question?

For the 3) it would be nice to be able to use that class, however as it is added in Java 8 and the SDK (and stack) support 6, it cannot be used.

– Bjarne

June 29, 2017
15:26, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 983
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

At least I’m able to load a test model without errors. I would need to see the string giving the error (or entire model would be fine too, you can send it to uajava-support@prosysopc.com) in order to help further. Anyway the XML parsing of structure values was fixed/implemented for custom structure in 2.3.2 (https://downloads.prosysopc.com/opcua/release_notes2.3.2-781.html), I suppose there might still be a bug somewhere there..

Just to be sure, did you also update the stack jar to version 1.02.337.18 in addition to the SDK jar to 2.3.2?

The test model that did pass:

<UANodeSet xmlns:xsi="http://www.w3.org/2001/XMLSche…..&quot; xmlns:uax="http://opcfoundation.org/UA/20…..&quot; xmlns="http://opcfoundation.org/UA/20…..&quot; xmlns:s1="http://yourorganisation.org/ba…..&quot; xmlns:xsd="http://www.w3.org/2001/XMLSche…..t;&gt;
<NamespaceUris>
<Uri>http://yourorganisation.org/ba…..ri&gt;
</NamespaceUris>
<Aliases>
<Alias Alias="Double">i=11</Alias>
<Alias Alias="String">i=12</Alias>
<Alias Alias="ByteString">i=15</Alias>
<Alias Alias="Organizes">i=35</Alias>
<Alias Alias="HasEncoding">i=38</Alias>
<Alias Alias="HasDescription">i=39</Alias>
<Alias Alias="HasTypeDefinition">i=40</Alias>
<Alias Alias="HasSubtype">i=45</Alias>
<Alias Alias="HasProperty">i=46</Alias>
<Alias Alias="HasComponent">i=47</Alias>
<Alias Alias="TestStructure">ns=1;i=3002</Alias>
</Aliases>
<Extensions>
<Extension>
<ModelInfo Tool="UaModeler" Hash="+Ux4guppoubo9KCZYLLcDQ==" Version="1.4.4"/>
</Extension>
</Extensions>
<UADataType NodeId="ns=1;i=3002" BrowseName="1:TestStructure">
<DisplayName>TestStructure</DisplayName>
<References>
<Reference ReferenceType="HasEncoding">ns=1;i=5001</Reference>
<Reference ReferenceType="HasEncoding">ns=1;i=5002</Reference>
<Reference ReferenceType="HasSubtype" IsForward="false">i=22</Reference>
</References>
<Definition Name="1:TestStructure">
<Field DataType="Double" Name="Field1"/>
<Field DataType="Double" Name="Field2"/>
<Field DataType="Double" Name="Field3"/>
</Definition>
</UADataType>
<UAVariable DataType="String" ParentNodeId="ns=1;i=6001" NodeId="ns=1;i=6005" BrowseName="1:TestStructure">
<DisplayName>TestStructure</DisplayName>
<References>
<Reference ReferenceType="HasComponent" IsForward="false">ns=1;i=6001</Reference>
<Reference ReferenceType="HasTypeDefinition">i=69</Reference>
<Reference ReferenceType="HasDescription" IsForward="false">ns=1;i=5001</Reference>
</References>
<Value>
<uax:String>TestStructure</uax:String>
</Value>
</UAVariable>
<UAVariable DataType="String" ParentNodeId="ns=1;i=6003" NodeId="ns=1;i=6006" BrowseName="1:TestStructure">
<DisplayName>TestStructure</DisplayName>
<References>
<Reference ReferenceType="HasComponent" IsForward="false">ns=1;i=6003</Reference>
<Reference ReferenceType="HasTypeDefinition">i=69</Reference>
<Reference ReferenceType="HasDescription" IsForward="false">ns=1;i=5002</Reference>
</References>
<Value>
<uax:String>//xs:element[@name=’TestStructure’]</uax:String>
</Value>
</UAVariable>
<UAVariable DataType="ByteString" NodeId="ns=1;i=6001" BrowseName="1:TypeDictionary">
<DisplayName>TypeDictionary</DisplayName>
<Description>Collects the data type descriptions of http://yourorganisation.org/base64test/</Description&gt;
<References>
<Reference ReferenceType="HasProperty">ns=1;i=6002</Reference>
<Reference ReferenceType="HasTypeDefinition">i=72</Reference>
<Reference ReferenceType="HasComponent">ns=1;i=6005</Reference>
<Reference ReferenceType="HasComponent" IsForward="false">i=93</Reference>
</References>
<Value>
<uax:ByteString>PG9wYzpUeXBlRGljdGlvbmFyeSB4bWxuczp4c2k9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZ
W1hLWluc3RhbmNlIiB4bWxuczp0bnM9Imh0dHA6Ly95b3Vyb3JnYW5pc2F0aW9uLm9yZy9iY
XNlNjR0ZXN0LyIgRGVmYXVsdEJ5dGVPcmRlcj0iTGl0dGxlRW5kaWFuIiB4bWxuczpvcGM9I
mh0dHA6Ly9vcGNmb3VuZGF0aW9uLm9yZy9CaW5hcnlTY2hlbWEvIiB4bWxuczp1YT0iaHR0c
DovL29wY2ZvdW5kYXRpb24ub3JnL1VBLyIgVGFyZ2V0TmFtZXNwYWNlPSJodHRwOi8veW91c
m9yZ2FuaXNhdGlvbi5vcmcvYmFzZTY0dGVzdC8iPgogPG9wYzpJbXBvcnQgTmFtZXNwYWNlP
SJodHRwOi8vb3BjZm91bmRhdGlvbi5vcmcvVUEvIi8+CiA8b3BjOlN0cnVjdHVyZWRUeXBlI
EJhc2VUeXBlPSJ1YTpFeHRlbnNpb25PYmplY3QiIE5hbWU9IlRlc3RTdHJ1Y3R1cmUiPgogI
DxvcGM6RmllbGQgVHlwZU5hbWU9Im9wYzpEb3VibGUiIE5hbWU9IkZpZWxkMSIvPgogIDxvc
GM6RmllbGQgVHlwZU5hbWU9Im9wYzpEb3VibGUiIE5hbWU9IkZpZWxkMiIvPgogIDxvcGM6R
mllbGQgVHlwZU5hbWU9Im9wYzpEb3VibGUiIE5hbWU9IkZpZWxkMyIvPgogPC9vcGM6U3Ryd
WN0dXJlZFR5cGU+Cjwvb3BjOlR5cGVEaWN0aW9uYXJ5Pgo=</uax:ByteString>
</Value>
</UAVariable>
<UAVariable DataType="String" ParentNodeId="ns=1;i=6001" NodeId="ns=1;i=6002" BrowseName="NamespaceUri">
<DisplayName>NamespaceUri</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=68</Reference>
<Reference ReferenceType="HasProperty" IsForward="false">ns=1;i=6001</Reference>
</References>
<Value>
<uax:String>http://yourorganisation.org/base64test/</uax:String&gt;
</Value>
</UAVariable>
<UAVariable DataType="ByteString" NodeId="ns=1;i=6003" BrowseName="1:TypeDictionary">
<DisplayName>TypeDictionary</DisplayName>
<Description>Collects the data type descriptions of http://yourorganisation.org/base64test/</Description&gt;
<References>
<Reference ReferenceType="HasProperty">ns=1;i=6004</Reference>
<Reference ReferenceType="HasTypeDefinition">i=72</Reference>
<Reference ReferenceType="HasComponent">ns=1;i=6006</Reference>
<Reference ReferenceType="HasComponent" IsForward="false">i=92</Reference>
</References>
<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cXVlbmNlPgogICA8eHM6ZWxlbWVudCBtaW5PY2N1cnM9IjAiIG1he
E9jY3Vycz0idW5ib3VuZGVkIiB0eXBlPSJ0bnM6VGVzdFN0cnVjdHVyZSIgbmFtZT0iVGVzd
FN0cnVjdHVyZSIgbmlsbGFibGU9InRydWUiLz4KICA8L3hzOnNlcXVlbmNlPgogPC94czpjb
21wbGV4VHlwZT4KIDx4czplbGVtZW50IHR5cGU9InRuczpMaXN0T2ZUZXN0U3RydWN0dXJlI
iBuYW1lPSJMaXN0T2ZUZXN0U3RydWN0dXJlIiBuaWxsYWJsZT0idHJ1ZSIvPgo8L3hzOnNja
GVtYT4K</uax:ByteString>
</Value>
</UAVariable>
<UAVariable DataType="String" ParentNodeId="ns=1;i=6003" NodeId="ns=1;i=6004" BrowseName="NamespaceUri">
<DisplayName>NamespaceUri</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=68</Reference>
<Reference ReferenceType="HasProperty" IsForward="false">ns=1;i=6003</Reference>
</References>
<Value>
<uax:String>http://yourorganisation.org/base64test/Types.xsd</uax:String&gt;
</Value>
</UAVariable>
<UAVariableType DataType="TestStructure" ValueRank="-2" NodeId="ns=1;i=2002" BrowseName="1:TestStructureVariableType">
<DisplayName>TestStructureVariableType</DisplayName>
<References>
<Reference ReferenceType="HasSubtype" IsForward="false">i=63</Reference>
</References>
<Value>
<uax:ListOfExtensionObject>
<uax:ExtensionObject>
<uax:TypeId>
<uax:Identifier>ns=1;i=5002</uax:Identifier>
</uax:TypeId>
<uax:Body>
<TestStructure xmlns="http://yourorganisation.org/base64test/Types.xsd"&gt;
<Field1>0</Field1>
<Field2>0</Field2>
<Field3>0</Field3>
</TestStructure>
</uax:Body>
</uax:ExtensionObject>
</uax:ListOfExtensionObject>
</Value>
</UAVariableType>
<UAVariable DataType="TestStructure" NodeId="ns=1;i=6008" BrowseName="1:TestStructureVariableInstance" UserAccessLevel="3" AccessLevel="3">
<DisplayName>TestStructureVariableInstance</DisplayName>
<References>
<Reference ReferenceType="Organizes" IsForward="false">i=85</Reference>
<Reference ReferenceType="HasTypeDefinition">ns=1;i=2002</Reference>
</References>
<Value>
<uax:ExtensionObject>
<uax:TypeId>
<uax:Identifier>ns=1;i=5002</uax:Identifier>
</uax:TypeId>
<uax:Body>
<TestStructure xmlns="http://yourorganisation.org/base64test/Types.xsd"&gt;
<Field1>0</Field1>
<Field2>0</Field2>
<Field3>0</Field3>
</TestStructure>
</uax:Body>
</uax:ExtensionObject>
</Value>
</UAVariable>
<UAObject SymbolicName="DefaultBinary" NodeId="ns=1;i=5001" BrowseName="Default Binary">
<DisplayName>Default Binary</DisplayName>
<References>
<Reference ReferenceType="HasEncoding" IsForward="false">ns=1;i=3002</Reference>
<Reference ReferenceType="HasTypeDefinition">i=76</Reference>
<Reference ReferenceType="HasDescription">ns=1;i=6005</Reference>
</References>
</UAObject>
<UAObject SymbolicName="DefaultXml" NodeId="ns=1;i=5002" BrowseName="Default XML">
<DisplayName>Default XML</DisplayName>
<References>
<Reference ReferenceType="HasEncoding" IsForward="false">ns=1;i=3002</Reference>
<Reference ReferenceType="HasTypeDefinition">i=76</Reference>
<Reference ReferenceType="HasDescription">ns=1;i=6006</Reference>
</References>
</UAObject>
</UANodeSet>
Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online:
38 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

rocket science: 77

Ibrahim: 76

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

fred: 41

Member Stats:

Guest Posters: 0

Members: 682

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1467

Posts: 6261

Newest Members:

karrimacvitie5, graciela2073, sagarchau, elviralangwell4, Donnavek, Eddiefauth, DonaldPooma, fidelduke938316, Jan-Pfizer, DavidROunc

Moderators: Jouni Aro: 1010, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 983, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 26, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 321, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1