14:57, EET
June 27, 2012
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?
17:05, EET
December 21, 2011
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)
Most Users Ever Online: 1919
Currently Online:
15 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: 738
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1529
Posts: 6471
Newest Members:
mickey21654, donnyredmond08, keesha4235, cheribruce, candacekolb4, Garmcrypto7Zof, calebhardison, susannahdingle7, inilarythikibia, rickykennionModerators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1032, Jimmy Ni: 26, Matti Siponen: 349, Lusetti: 0
Administrators: admin: 1