Hi Jim,

Just a few thoughts,

Check to see if you have write permission on the ua server.

Is there a leading space before your address, s= S7...?


On Thu, Mar 11, 2021 at 9:29 AM Wang, Jim <[email protected]> wrote:

> Hi PLC4X team,
>
> When I use PLC4X's OPCUA protocol to write PLC, I always get ACCESS_DENIED
> for the PLC's tag (Reading is OK.)
> I list my code and message I get below in FYI: sections.
> How can I get rid of this issue?
> Thanks,
>
> Jim
>
>
> FYI: my codes
> ==================================
>        public static void WritePLC(PlcConnection plcConnection) throws
> InterruptedException, Exception, TimeoutException {
>               PlcWriteRequest.Builder builder =
> plcConnection.writeRequestBuilder();
>               builder.addItem("S7PLC.CureAbort", "ns=2;s=
> S7PLC.CureAbort:BOOL", true);
>               PlcWriteRequest writeRequest = builder.build();
>               PlcWriteResponse response = writeRequest.execute().get();
>               for (String fieldName : response.getFieldNames()) {
>                   if(response.getResponseCode(fieldName) ==
> PlcResponseCode.OK) {
>                      System.out.println("Value[" + fieldName + "]:
> updated");
>                   }
>                   else {
>                      System.out.println("Error[" + fieldName + "]: " +
> response.getResponseCode(fieldName).name());
>                   }
>               }
>        }
>
> FYI: the message when I run my codees
> ======================================
> opcua:tcp://localhost:49601/
> [main] INFO org.apache.plc4x.java.PlcDriverManager - Instantiating new PLC
> Driver Manager with class loader
> jdk.internal.loader.ClassLoaders$AppClassLoader@443b7951<mailto:
> jdk.internal.loader.ClassLoaders$AppClassLoader@443b7951>
> [main] INFO org.apache.plc4x.java.PlcDriverManager - Registering available
> drivers...
> [main] INFO org.apache.plc4x.java.PlcDriverManager - Registering driver
> for Protocol s7 (Siemens S7 (Basic))
> [main] INFO org.apache.plc4x.java.PlcDriverManager - Registering driver
> for Protocol opcua (OPC UA (TCP))
> [main] INFO org.apache.plc4x.java.opcua.connection.OpcuaTcpPlcConnection -
> Configured OpcuaTcpPlcConnection with: host-name 127.0.0.1
> [NonceUtilSecureRandom] INFO
> org.eclipse.milo.opcua.stack.core.util.NonceUtil - SecureRandom seeded in
> 0ms.
> [main] INFO org.eclipse.milo.opcua.sdk.client.OpcUaClient - Eclipse Milo
> OPC UA Stack version: 0.5.3
> [main] INFO org.eclipse.milo.opcua.sdk.client.OpcUaClient - Eclipse Milo
> OPC UA Client SDK version: 0.5.3
> Error[S7PLC.CureAbort]: ACCESS_DENIED
> Find West on Twitter <http://twitter.com/#!/WestPharma> and LinkedIn<
> http://www.linkedin.com/company/west-pharmaceutical-services?trk=fc_badge
> >.
>
> ________________________________
> The contents of this message are confidential and may be privileged. If
> you have received this message in error, please permanently delete it,
> along with any files that may be attached to this message, without reading,
> printing, copying, forwarding or otherwise distributing it. Please notify
> the sender of the error immediately so that we can prevent it from
> happening again.
>
>

Reply via email to