eclipsefile-transferopc-uaopcmilo

Open, read and write files with Eclipse Milo OPC UA


I always get the error message

Exception in thread "main" UaMethodException: status=Bad_NotFound, message=A requested item was not found or a search operation ended without success..

To open the file in read mode, I have to set the first bit in a byte to 1. I am unable to do this.




val nodeId = new NodeId(2, "Demo.Files.readwrite.txt") 

  val client: Option[OpcUaClient] = OpcConnector.createOpcClients()
  
  val objectNode = client.get.getAddressSpace.getObjectNode(nodeId)

  val x = new QualifiedName(0, "Open")

  val method = objectNode.getMethod(x)

  val b: Byte = 1
  val inputs: Array[Variant] = Array(new Variant(b))
  val outputs: Array[Variant] = method.call(inputs)
  private val logger = LoggerFactory.getLogger(getClass)
  logger.info("Input values: " + inputs.mkString("Array(", ", ", ")"))
  logger.info("Output values: " + outputs.mkString("Array(", ", ", ")"))

I tried to declare b as a byte and set b to 1 to get "00000001".


Solution

  • It's probably objectNode.getMethod(x) that is throwing this Exception...

    Are you able to get a Wireshark capture of this? Are you sure you have the right ObjectNode?