Hi all,
Thanks for your valuable contribution.
I'm trying to map aasx to opcua like the following picture:
However, when I export nodeset2.xml from package-explorer and import it to the OPC UA server using the following script in Python, it gives me an exception. Do you know how to do that?
I would greatly appreciate it if you can help me with this.
import logging
from opcua import Server
logging.basicConfig(level=logging.INFO)
_logger = logging.getLogger('asyncua')
def main():
server = Server()
filename = "Opc_export.xml"
server.import_xml(filename)
server.start()
if __name__ == '__main__':
main()
Exception:
INFO:opcua.common.xmlparser:Parsing node: ns=1;s=AssetAdminShell 1:AssetAdminShell
INFO:opcua.common.xmlparser:Could not detect backward reference to parent for node 'ns=1;s=AssetAdminShell'
INFO:opcua.common.xmlimporter:Importing xml node (QualifiedName(1:AssetAdminShell), StringNodeId(ns=1;s=AssetAdminShell)) as (QualifiedName(2:AssetAdminShell) StringNodeId(ns=2;s=AssetAdminShell))
INFO:opcua.server.address_space:add_node: while adding node StringNodeId(ns=2;s=AssetAdminShell), requested parent node is null TwoByteNodeId(i=0) True
WARNING:opcua.common.xmlimporter:failure adding node NodeData(nodeid:StringNodeId(ns=1;s=AssetAdminShell))
Traceback (most recent call last):
File "C:\Users\hadifar\IdeaProjects\opc\python-src\opc-experiment\server2.py", line 22, in
main()
File "C:\Users\hadifar\IdeaProjects\opc\python-src\opc-experiment\server2.py", line 15, in main
server.import_xml('new2.xml')
File "C:\Users\hadifar\IdeaProjects\opc\venv\lib\site-packages\opcua\server\server.py", line 518, in import_xml
return importer.import_xml(path, xmlstring)
File "C:\Users\hadifar\IdeaProjects\opc\venv\lib\site-packages\opcua\common\xmlimporter.py", line 68, in import_xml
node = self._add_node_data(nodedata)
File "C:\Users\hadifar\IdeaProjects\opc\venv\lib\site-packages\opcua\common\xmlimporter.py", line 83, in _add_node_data
node = self.add_object(nodedata)
File "C:\Users\hadifar\IdeaProjects\opc\venv\lib\site-packages\opcua\common\xmlimporter.py", line 184, in add_object
res[0].StatusCode.check()
File "C:\Users\hadifar\IdeaProjects\opc\venv\lib\site-packages\opcua\ua\uatypes.py", line 218, in check
raise UaStatusCodeError(self.value)
opcua.ua.uaerrors._auto.BadParentNodeIdInvalid: "The parent node id does not to refer to a valid node."(BadParentNodeIdInvalid)
Hi all, Thanks for your valuable contribution. I'm trying to map aasx to opcua like the following picture:
However, when I export
nodeset2.xml
from package-explorer and import it to the OPC UA server using the following script in Python, it gives me an exception. Do you know how to do that?I would greatly appreciate it if you can help me with this.
Exception: