Online Forums
Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.
Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.
Do not use the Contact page for technical issues.
Write Byte Array
The choice between accepting or rejecting the Write with timestamps, even differently on different nodes, is fully in the responsibility of the server, and either way the server does it (for nodes where the spec does not prescribe it somehow), it is OPC UA compliant.
Best regards
Please Log in or Create an account to join the conversation.
- phil56
- Topic Author
- Visitor
Indeed if I use the "Write" method without "timestamp" update, the modification works.
However, if I use the "Write" method to update scalar variables (bool, integer...) with timestamp modification, it works, hence my questioning.
A server bug?
Best regards
Phil
Please Log in or Create an account to join the conversation.
What your other ("Write") example is doing is that it attempts to write the data value AND a timestamp. Not all servers or nodes support that. And the error is telling you that.
Or are you saying that you are somehow able to write data value AND a timestamp with UaExpert? If so, please educate me on how this can be done.
Best regards
Please Log in or Create an account to join the conversation.
- phil56
- Topic Author
- Visitor
support wrote: How do you know that the node you are writing is actually writeable? Have you tried it with some other OPC UA client?
Thank you
For me the node is writable because the WriteWalue method works and if I try another OPC UA client (UAExpert) I can Update the variable.
Please Log in or Create an account to join the conversation.
the error originated in the server. How do you know that the node you are writing is actually writeable? Have you tried it with some other OPC UA client?
Thank you
Please Log in or Create an account to join the conversation.
- phil56
- Topic Author
- Visitor
In my PLC I have an array of bytes variable, I can read them with the "Read" method but if I want to write bytes into it with the "Write" method, an exception is thrown:
OpcLabs.EasyOpc.UA.OperationModel.UAException: An OPC-UA operation failure with error ID 'Opc.UA.ServiceResult=0x80730000' occurred, originating from 'OpcLabs.EasyOpcUA' and with depth of 1. The inner OPC-UA service exception with service result 'BadWriteNotSupported' contains details about the problem. ---> OpcLabs.EasyOpc.UA.UAServiceException: OPC-UA service result - An error specific to OPC-UA service occurred (status code: BadWriteNotSupported). Details follow.
---- SERVICE RESULT ----
Status Code: {BadWriteNotSupported} = 0x80730000 (2155020288)
+ A list of parts provided (or not provided) to the Write operation follows. Value: yes, index range: no, source timestamp: yes, server timestamp: no.
+ The client method called was 'WriteMultiple'.
--- Fin de la trace de la pile d'exception interne ---
à OpcLabs.EasyOpc.UA.IEasyUAClientExtension.Write(IEasyUAClient client, UAWriteArguments writeArguments)
à OpcLabs.EasyOpc.UA.IEasyUAClientExtension.Write(IEasyUAClient client, UAEndpointDescriptor endpointDescriptor, UANodeDescriptor nodeDescriptor, UAAttributeData attributeData, Type valueType)
à OpcLabs.EasyOpc.UA.IEasyUAClientExtension.Write(IEasyUAClient client, UAEndpointDescriptor endpointDescriptor, UANodeDescriptor nodeDescriptor, UAAttributeData attributeData)
à TestOpcUA.Program.Test2() dans D:\vcpp\TestOpcUA47\TestOpcUA\Program.cs:ligne 78
à TestOpcUA.Program.Main(String[] args) dans D:\vcpp\TestOpcUA47\TestOpcUA\Program.cs:ligne 98
If I use the "WriteValue" method, I can write the bytes without exception.
Where is my mistake?
Sample code with Write method :
Init();
var client = new EasyUAClient();
var endPointDescription = new UAEndpointDescriptor("opc.tcp://10.145.14.31:48050");
UAAttributeData attributeData = client.Read(endPointDescription, "ns=7;s=MAIN.barrayV");
object ret = null;
//read ok
if (attributeData.HasGoodStatus == true)
{
ret = attributeData.Value;
var bytes = ret as Byte[];
for (int i = 0; i < bytes?.Length; i++)
{
bytes[i] = (byte)(1 - bytes[i]);
}
UAAttributeData writeValue = new UAAttributeData(bytes, UASeverity.GoodOrSuccess, DateTime.UtcNow);
client.Write(endPointDescription, "ns=7;s=MAIN.barrayV", writeValue);
}
Sample code with WriteValue method :
Init();
var client = new EasyUAClient();
var endPointDescription = new UAEndpointDescriptor("opc.tcp://10.145.14.31:48050");
UAAttributeData attributeData = client.Read(endPointDescription, "ns=7;s=MAIN.barrayV");
object ret = null;
//read ok
if (attributeData.HasGoodStatus == true)
{
ret = attributeData.Value;
var bytes = ret as Byte[];
for (int i = 0; i < bytes?.Length; i++)
{
bytes[i] = (byte)(1 - bytes[i]);
}
client.WriteValue(endPointDescription, "ns=7;s=MAIN.barrayV", bytes);
}
QuickOPC-UA version 2020.2
best regards
Phil
Please Log in or Create an account to join the conversation.