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.

Value of empty string nodes in UA

More
24 Mar 2022 13:13 #10751 by support
Yes, it probably means that.

But, you can see already on the 2nd line, that it has turned the empty string to null, while the sample server keeps it as an empty string.
Note: My version displays "null" for a null value, your version displays "(none)", but this is because we have changed the output format in newer versions, but it is the same thing.

Best regards
The following user(s) said Thank You: zaglerp

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

More
24 Mar 2022 13:04 #10750 by zaglerp
Hi!

when running your sample against KEPServerEX I get:

ABC {System.String} @2022-03-24T12:59:14.645 @@2022-03-24T12:59:14.645; Good
(none) {} @2022-03-24T12:59:14.707 @@2022-03-24T12:59:14.707; Good

Then an exception is thrown:
{"An OPC-UA operation failure with error ID 'Opc.UA.ServiceResult=0x80740000' occurred, originating from 'OpcLabs.EasyOpcUA' and with depth of 1. The inner OPC-UA service exception with service result 'BadTypeMismatch' contains details about the problem."}

Does this mean the OPC server has refused the value of null?

Kind regards
Peter

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

More
23 Mar 2022 17:21 #10749 by support
Hello.
Yes, QuickOPC does not change values it reads or writes (leaving aside types conversions if necessary to resolve between UA and .NET, but this is not our case here).

Here is a test program I wrote that writes "ABC", "", and null to a string variable, and reads it back, with the sample OPC server by OPC Foundation:
using OpcLabs.EasyOpc.UA;
 
var client = new EasyUAClient();
 
client.WriteValue("opc.tcp://opcua.demo-this.com:51210/UA/SampleServer", "nsu=http://test.org/UA/Data/ ;ns=2;i=10227", "ABC");
Console.WriteLine(client.Read("opc.tcp://opcua.demo-this.com:51210/UA/SampleServer", "nsu=http://test.org/UA/Data/ ;ns=2;i=10227"));
 
client.WriteValue("opc.tcp://opcua.demo-this.com:51210/UA/SampleServer", "nsu=http://test.org/UA/Data/ ;ns=2;i=10227", "");
Console.WriteLine(client.Read("opc.tcp://opcua.demo-this.com:51210/UA/SampleServer", "nsu=http://test.org/UA/Data/ ;ns=2;i=10227"));
 
client.WriteValue("opc.tcp://opcua.demo-this.com:51210/UA/SampleServer", "nsu=http://test.org/UA/Data/ ;ns=2;i=10227", null);
Console.WriteLine(client.Read("opc.tcp://opcua.demo-this.com:51210/UA/SampleServer", "nsu=http://test.org/UA/Data/ ;ns=2;i=10227"));

and here is its output:
ABC {String} @2022-03-23T17:16:24.820 @@2022-03-23T17:16:24.867; Good
 {String} @2022-03-23T17:16:24.960 @@2022-03-23T17:16:25.007; Good
null {} @2022-03-23T17:16:25.038 @@2022-03-23T17:16:25.070; Good

As you can see, the values we get back are the same as those we have passed in.
So I believe the KEPServerEX is doing this. In general there is nothing that forces the server to return back in Read) the same value that was written.

Best regards
The following user(s) said Thank You: zaglerp

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

More
23 Mar 2022 14:54 #10747 by zaglerp
Hi,

thank you for your answer. Yes, my question is about UA.

I am using KEPServerEX in simulation mode and my client is using C#.
For the moment I have no access to other servers.

Just for my understanding:
QuickOPC is not changing the value, null and/or empty values are passed without changes. Correct?
But the OPC server may interfer and transform an empty value into null?

Kind regards
Peter

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

More
22 Mar 2022 12:38 #10746 by support
Hello.
For my reply, I assume that this question is really about OPC UA (as the title suggests), and not about OPC Classic (as the forum category suggests).

I think that the null string and an empty string should be different in OPC UA. The difference may get blurred when some tools (such as Delphi) are used, but should work in C#, VB.NET etc.

This may be a server issue too.

Some questions:
1. Which OPC server are you using?
2. Have you tried the same operation with some other server?
3. Have you tried the same operations to your server with some other OPC client?

Best regards

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

More
22 Mar 2022 06:57 #10745 by zaglerp
Hi,

Is there a difference between empty string and null for OPC nodes of type 'String'?
After setting the value to an empty string, null is returned for reading the node.

What is the reason for this?

Kind regards
Peter

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

Moderators: support
Time to create page: 0.064 seconds