如何通过milo从客户端将Node添加到服务器?

时间:2019-12-11 15:55:30

标签: opc-ua milo

我试图像这样从客户端将Node添加到服务器:

        AddNodesItem newItem = new AddNodesItem(
                new NodeId(2,"Vehicles").expanded(),
                Identifiers.Organizes,
                new NodeId(2,"Vehicles/vehicle2").expanded(),
                new QualifiedName(2,"Vehicles/vehicle2"),
                NodeClass.Object,
                null,
                new NodeId(2,"Object/Types/Vehicle").expanded());

        List<AddNodesItem> items = new ArrayList<AddNodesItem>();
        items.add(newItem);

        client.addNodes(items).get();
        future.complete(client);

但是我只有错误:

[main] ERROR Client1.Client - Error running client example: UaServiceFaultException: status=Bad_ServiceUnsupported, message=The server does not support the requested service.
java.util.concurrent.ExecutionException: UaServiceFaultException: status=Bad_ServiceUnsupported, message=The server does not support the requested service.
    at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
    at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1895)
    at Client1.AddNode.run(AddNode.java:37)
    at Client1.Client.run(Client.java:103)
    at Client1.AddNode.main(AddNode.java:18)

我搜索了一下,也许我应该首先进行服务器配置,但是如何? 任何指导或答案都会有所帮助,非常感谢!

1 个答案:

答案 0 :(得分:0)

您的客户端代码看起来还不错,但这仅适用于已实现并支持节点管理服务的服务器。

Milo示例服务器未实现这些服务,因此您必须找到其他服务器进行测试。