Professional OPC
Development Tools

logos

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.

BadWriteNotSupported error while writing a struct value

More
18 Aug 2021 07:04 #10122 by goosvanbeek
No problem at all!

Best regards.

Please Log in or Create an account to join the conversation.

More
18 Aug 2021 06:36 #10120 by support
I am glad you found the cause. Sorry that I could not react earlier.

Best regards

Please Log in or Create an account to join the conversation.

More
18 Aug 2021 06:23 #10119 by goosvanbeek
Already found it out
.
I used
client.WriteValue(endpointDescriptor, nodeDescriptor, attributeData);
instead of
client.WriteValue(endpointDescriptor, nodeDescriptor, uaGenericObject);
Now it's working as expected.

Please Log in or Create an account to join the conversation.

More
17 Aug 2021 19:01 #10118 by goosvanbeek
Hi Support,


VS 2019/QuickOPC 5.61.241
I'm using the code below to write a struct value
static void Main(string[] args){
            UAEndpointDescriptor endpointDescriptor = "opc.tcp://localhost:48030/";
            UANodeDescriptor     nodeDescriptor     = "ns=2;i=6009";
 
            using(var client = new EasyUAClient()){
                try{
                    var attributeData = client.Read(endpointDescriptor, nodeDescriptor);
                    if(attributeData?.Value is UAGenericObject uaGenericObject){
                        var fieldData = (((StructuredData)uaGenericObject.GenericData)?.FieldData);
                        if(fieldData == null){
                            return;
                        }
 
                        var batchCode      = ((PrimitiveData)fieldData["BatchCode"]).Value;
                        var bundleCode     = ((PrimitiveData)fieldData["BundleCode"]).Value;
                        var boardCount     = ((PrimitiveData)fieldData["BoardCount"]).Value;
                        var boardLength    = ((PrimitiveData)fieldData["BoardLength"]).Value;
                        var boardWidth     = ((PrimitiveData)fieldData["BoardWidth"]).Value;
                        var boardThickness = ((PrimitiveData)fieldData["BoardThickness"]).Value;
 
                        //((PrimitiveData)fieldData["BoardCount"]).Value = 123;
                        //client.Write(endpointDescriptor, nodeDescriptor, attributeData);
                        client.WriteValue(endpointDescriptor, nodeDescriptor, attributeData);
                    }
                }
                catch(UAException uaException){
                    Console.WriteLine("*** Failure: {0}", uaException.GetBaseException().Message);
                }
            }
        }
This causes the exception below
Exception:
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.
 
InnerException:
OPC UA service result - {BadWriteNotSupported}. The server does not support writing the combination of value, status and timestamps provided.
+ A list of parts provided (or not provided) to the Write operation follows. Value: yes, index range: no, source timestamp: yes, server timestamp: yes.
+ When writing, be aware that writing the server timestamp (in this call, 17/08/2021 18:38:28) is not supported by some servers, including the OPC Foundation sample server.
+ The node descriptor used was: NodeId="ns=2;i=6009".
+ The client method called (or event/callback invoked) was 'WriteMultiple'.
I am able to update the values with UaExpert.
I'm using a test server which I attached.

Can you help me any further?

Best regards,
Goos van Beek.

File Attachment:

File Name: TestServer.rar
File Size:1,092 KB
Attachments:

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.051 seconds