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
Custom Types, and BadNodeIdUnknown problem
February 13, 2013
14:57, EET
Avatar
TimK
Member
Members
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:

PersonType
—– HasEncoding ———
V
Default XML ——– HasTypeDefinition ———–> DataTypeEncodingType
|
V—– HasDescription —–
PersonXMLType

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
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1009
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:Documentation> 
  <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"/> 
</opc:StructuredType>

(Spec. Part 3. Annex C)

February 14, 2013
17:11, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1009
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: 518

Currently Online:
16 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

rocket science: 77

ibrahim: 75

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

fred: 41

Member Stats:

Guest Posters: 0

Members: 685

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1467

Posts: 6259

Newest Members:

Jan-Pfizer, DavidROunc, fen.pang@woodside.com, aytule, rashadbrownrigg, christi10l, ahamad1, Flores Frederick, ellenmoss, harriettscherer

Moderators: Jouni Aro: 1009, 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