You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to call a method but have problems getting the InputArguments encoding from the server.
Situation
The method is GenerateFileForRead. If I open the "Call" method dialogue window in UaExpert, I can see the argment is of type ProductionDatasetReadOptionsType and has two fields, Storage (an Enum) and Name (String):
The Attributes of the InputArguments reference DataType ns=4;i=3007.
Node ns=4;i=3007 is indeed ProductionDatasetReadOptionsType. But it has no DataTypeDefinition, nor anything else that hints at fields Storage and Name or its DataTypes. Its encoding are defaults.
Goal/Problem
I want to call the method. For that I need to encode the input argument, but it is missing its DataTypeDefinition. I'm trying to repeat the trick of discussion #1703 and define my own DataType with the DataTypeDefinition and StructureFields that I expect, but I still need an encoding for that, and seemingly no way to get it. The referenced Default Binary and Default XML for ProductionDatasetReadOptionsType have null encodings.
But that makes me wonder:
Question
When displaying the "Call" method dialogue, UaExpert somehow knows how to resolve the input argument into its fields Storage and Name, and even correctly resolve the Storage Enum. I should be able to replicate that by following references through the OPC UA structure, and find the encoding. But I cannot figure out how; even igonring the encoding, ProductionDatasetReadOptionsType does not appear to contain or reference this structure (the fields, their types, ...) at all. What am I missing?
I have tried that already. I wrote a custom DataType as a copy of the given DataType, just with a DataTypeDefinition added.
val inputDataType: DataType = ... // ProductionDatasetReadOptionsType
val inputDataTypeExpanded: DataType = new DataType() {
override def getBinaryEncodingId: NodeId = inputDataType.getBinaryEncodingId // ns=4;i=5012
override def getXmlEncodingId: NodeId = inputDataType.getXmlEncodingId
override def getJsonEncodingId: NodeId = inputDataType.getJsonEncodingId
override def getBrowseName: QualifiedName = inputDataType.getBrowseName
override def getNodeId: NodeId = inputDataType.getNodeId
override def isAbstract: lang.Boolean = inputDataType.isAbstract
override def getDataTypeDefinition: DataTypeDefinition =
new StructureDefinition(
getBinaryEncodingId,
new NodeId(0,22), // baseDataType: Structure
StructureType.Structure,
new StructureField[] {...}
)
}
val input = new DynamicStructType(inputDataTypeExpanded, members)
ExtensionObject.encode(client.getDynamicEncodingContext, input) // throws exception:
// org.eclipse.milo.opcua.stack.core.UaSerializationException: no codec registered for encodingId=ns=4;i=5012
Re: dictionary
Yes, there are two dictionaries!
(The ProductionDatasetReadOptionsType node here has the same EncodingId as the one above: ns=4;i=5012)
I have just tried to access the dictionaries and am already at the next problem:
val namespaceUri = ... // value of Node "NamespaceUri", child of dictionary Node
val dict = client.getDynamicDataTypeManager.getTypeDictionary(namespaceUri) // dict = null
I don't recommend this because it's not a very complete mapping of all the variations of OPC UA types and uses a different "dynamic struct" representation. It's deprecated, so it's provided to you as-is.
Each of those Euromap nodes will have a ByteString value that is a relatively large XML document. Inside the XML document you'll find the datatype/struct definitions.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Hello!
I want to call a method but have problems getting the InputArguments encoding from the server.
Situation
The method is GenerateFileForRead. If I open the "Call" method dialogue window in UaExpert, I can see the argment is of type
ProductionDatasetReadOptionsTypeand has two fields, Storage (an Enum) and Name (String):The Attributes of the InputArguments reference DataType ns=4;i=3007.
Node ns=4;i=3007 is indeed
ProductionDatasetReadOptionsType. But it has no DataTypeDefinition, nor anything else that hints at fields Storage and Name or its DataTypes. Its encoding are defaults.Goal/Problem
I want to call the method. For that I need to encode the input argument, but it is missing its DataTypeDefinition. I'm trying to repeat the trick of discussion #1703 and define my own DataType with the DataTypeDefinition and StructureFields that I expect, but I still need an encoding for that, and seemingly no way to get it. The referenced Default Binary and Default XML for
ProductionDatasetReadOptionsTypehavenullencodings.But that makes me wonder:
Question
When displaying the "Call" method dialogue, UaExpert somehow knows how to resolve the input argument into its fields Storage and Name, and even correctly resolve the Storage Enum. I should be able to replicate that by following references through the OPC UA structure, and find the encoding. But I cannot figure out how; even igonring the encoding,
ProductionDatasetReadOptionsTypedoes not appear to contain or reference this structure (the fields, their types, ...) at all. What am I missing?All reactions