Please consider registering

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
Custom Types, and BadNodeIdUnknown problem
February 13, 2013
14:57, EET
Forum Posts: 41
Member Since:
June 27, 2012
sp_UserOfflineSmall Offline

I’m trying to expose to the client a definition for a complex type in my server.
I have created a new DataType node under DataTypes/Structure called PersonType, and a new DataItemType node at DataTypes/XML Schema/My Types/PersonXMLType, that I’m going to use to define the XML data. I need to create a node called “Default XML” that ties these two nodes together. The PersonType node will have a HasEncoding reference to Default XML, and Default XML will have a HasDescription reference to PersonXMLType. Default XML also needs a HasTypeDefinition reference to DataTypeEncodingType. So the references should be something like this:

—– HasEncoding ———
Default XML ——– HasTypeDefinition ———–> DataTypeEncodingType
V—– HasDescription —–

Here’s the code I’m using to create the Default XML node:
final NodeId defXmlNodeId = new NodeId(namespaceIndex, “Default XML PersonType”);
QualifiedName defXmlBrowseName = new QualifiedName(namespaceIndex, “Default XML”);
LocalizedText defXmlDisplayName = new LocalizedText(“Default XML”, (Locale)null);
UaNode defXmlNode = nodeFactory.createNode(NodeClass.Object, defXmlNodeId,
defXmlBrowseName, defXmlDisplayName);
personTypeNode.addReference(defXmlNodeId, Identifiers.HasEncoding, false);
defXmlNode.addReference(dataTypeEncodingType, Identifiers.HasTypeDefinition, false);
defXmlNode.addReference(personXmlTypeNode, Identifiers.HasDescription, false);

After creating the references above, if I use a client to browse to the PersonType node, I’m getting an error BadNodeIdUnknown. I can see the PersonTypeNode in the tree, but It seems like maybe the Default XML node doesn’t really stick around, and so the HasEncoding reference is broken. Do I need to do something else when adding this node?

February 14, 2013
17:05, EET
Jouni Aro
Forum Posts: 960
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

At least you should try to define the Default Binary encoding, instead of Default XML, since the Java stack does not yet support the XML encoding.

The defXmlNode that you are creating is indeed not added to the address space. You should add it to your NodeManager, so it can be located from there.

The structure of the binary encoding should be defined with an XML document, e.g.

<opc:StructuredType Name="DataValue">
  <opc:Documentation>A value with an associated timestamp, and quality.
  <opc:Field Name="ValueSpecified" TypeName="Bit" />
  <opc:Field Name="StatusCodeSpecified" TypeName="Bit" />
  <opc:Field Name="TimestampSpecified" TypeName="Bit" />
  <opc:Field Name="Reserved1" TypeName="Bit" Length="5" />
  <opc:Field Name="Value" TypeName="Variant" SwitchField="ValueSpecified" />
  <opc:Field Name="Quality" TypeName="Quality" SwitchField="StatusCodeSpecified" />
  <opc:Field Name="Timestamp" TypeName="opc:DateTime" SwitchField="SourceTimestampSpecified"/> 

(Spec. Part 3. Annex C)

February 14, 2013
17:11, EET
Jouni Aro
Forum Posts: 960
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

TimK said

personTypeNode.addReference(defXmlNodeId, Identifiers.HasEncoding, false);

Or you should just use the defXmlNode here, instead of the Id.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 267

Currently Online:
14 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 124

pramanj: 86

ibrahim: 74

rocket science: 65

kapsl: 57

Sabari: 51

gjevremovic: 49

Xavier: 43

fred: 41

TimK: 41

Member Stats:

Guest Posters: 0

Members: 1749

Moderators: 15

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1323

Posts: 5649

Newest Members:

WalterFOUNC, datafastproxiespx01, LenkaLok, seoninet, justinevillanuev, namtrott5457, DonaldWibip, AlfredoEthix, andreidla, everangel7021

Moderators: Jouni Aro: 960, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 860, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 25, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 222, Lusetti: 0

Administrators: admin: 1