Can’t write amount of data to kepware

1

When I write data to kepware server by milo, sometimes some data can not be written successfully. But the server returned

StatusCode{name=Good, value=0x00000000, quality=good}

The server did not display the data which I had written.
Thanks in advance for any help

  1. Single thread did not work.
  2. Create new client when start to write data.
  3. There is only one client which responds to writing.

All of these failed.

 mWriteClient = new OPCUAClientRunner(KSOPCUASubscription.this).createClient();
                mWriteClient.connect().get();
            } catch (Exception e) {
                e.printStackTrace();
                logger.error("OPCUAClient connect Exception", e);
                return ;
            }
            logger.info("Wrote identifier: " + identifier);
            List<NodeId> nodeIds = ImmutableList.of(new NodeId(namespaceIndex, identifier));//Int32"t|bbb"

            Variant v = new Variant(value);

            // don't write status or timestamps
            DataValue dv = new DataValue(v, null, null);
            logger.info("OPCUAClient begin write");
            // write asynchronously....
            CompletableFuture<List<StatusCode>> f =
                    mWriteClient.writeValues(nodeIds, ImmutableList.of(dv));

            // ...but block for the results so we write in order
            List<StatusCode> statusCodes = null;
            try {
                statusCodes = f.get();
            } catch (InterruptedException e) {
                e.printStackTrace();
                logger.error("OPCUAClient write get response Exception", e);
            } catch (ExecutionException e) {
                e.printStackTrace();
                logger.error("OPCUAClient write get response Exception", e);
            }
            StatusCode status = statusCodes.get(0);
            logger.info("Wrote status: " + status.toString());
            if (status.isGood()) {
                logger.info("Wrote '{}' to nodeId={}", v, nodeIds.get(0));
            }
opc
milo
asked on Stack Overflow Mar 24, 2019 by weiweizhou • edited Mar 24, 2019 by Oram

1 Answer

0

Unless you're not actually writing the value you claim to be writing, a StatusCode of Good from the server means you're not doing anything wrong on the client side.

Maybe you can capture the exchange with Wireshark to further prove the issue is on the server side.

answered on Stack Overflow Mar 25, 2019 by Kevin Herron

User contributions licensed under CC BY-SA 3.0