You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My question is: is this package working as intended, and the servers I'm using are at fault, or is this a problem, and it isn't possible to write an empty string with the package as is.
The text was updated successfully, but these errors were encountered:
Good point. We don't have any problem with this and we have a couple of thousand deployments on both Siemens and Beckhoff PLCs. @kung-foo also doesn't seem to have a problem with this. So I don't expect this to be a wide spread problem.
The challenge is that both server and client language have to cooperate since both can support either both or only one of them. If the string node isn't nullable you can't write a NULL string. If your programming language doesn't support null strings you have to pick one encoding. I think that's why I chose null strings at the time.
You can write your own Encode and Decode method for your struct. Check ua/datatypes.go for examples. It looks like WriteByteString does what you want.
I'm currently using this package in production with several machines that have the "Siemens Sinumerik One" control w/ opcua server.
I ran into the issue that attempting to write an empty string to a node with a string value results in a StatusBad(0x80000000).
After some debugging, I found that for empty strings, the client sends a null value for the length of the string in the following lines: https://github.com/gopcua/opcua/blob/708f669296f58deba4d100507115e02166c0f0f9/ua/buffer.go#L273C1-L280C1. I've got my application working with a fork that writes a zero to the string length instead of the null value for empty strings.
My question is: is this package working as intended, and the servers I'm using are at fault, or is this a problem, and it isn't possible to write an empty string with the package as is.
The text was updated successfully, but these errors were encountered: