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.

String representation of NodeId and URN descriotor

More
04 May 2012 12:21 #841 by support
Hello,
since you are using "2" for the "namespace", I can guess that it is not the actual namespace - it is its index in so-called "namespace table" in the UA Server. The namespace indexes are used for efficiency, but they are not guaranteed to remain the same over the time (new sessions). In general case, they are therefore not suitable for direct persistence (or to be included in the code) on the client side. The UA client should persist/contain the namespace string, read the server's namespace table, convert the namespace string(s) to the indices, and then use the indices as needed.
QuickOPC-UA does this automatically - so you are supposed to actually specify the namespace string in the Node ID, not the index. Namespace strings look like URLs or URNs. For example, opcfoundation.org/UA/ is a fixed namespace string (for index 0) reserved by the OPC Foundation. There will be more namespaces in your server.
You should be able to find the namespace strings in the server's documentation, or by browsing using e.g. our EasyOpcUAConsole utility (included with the product). The namespace table should also be available as a readable array from the server itself, at NodeId "nsu=http://opcfoundation.org/UA/;i=2255".
If you browse the server using methods in QuickOPC-UA, the Node IDs will be returned already in the proper format.
After figuring out the namespace string, your NodeId will probably look more like "nsu=http://servervendor.com/UA/something;s=PowerHub.LU1.WatchdogDevelopment", i.e. the "2" in your original will be replaced by something longer. Also note that "nsu" (for "Namespace URI") is used instad of "ns".

Best regards,

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

More
04 May 2012 11:56 #840 by laoch
Hi
I am trying to make you sampe application connect to our UA server. But I have a hard time finding out how to represent the NodeID.
I have made it JAVA and succesfully used NodeID: "ns=2;s=PowerHub.LU1.WatchdogDevelopment"
Endpoint URL is opc.tcp://ipadress:portnumber
I fill this in to you sample code in the following way:
UANodeId nid = new UANodeId("ns=2;s=PowerHub.LU1.WatchdogDevelopment");
textBox1.Text = easyUAClient1.ReadValue("opc.tcp://ipadress:portnumber", nid).ToString();
But this does not work. I have the feeling that I am specifying the NodeID incorrectly. Could you help me out here?
It works fine in java with the following code so the setup is correct:
client = new UaClient("opc.tcp://ipaddress:port");
client.setSecurityMode(SecurityMode.NONE);
client.connect();
String test = client.getHost();
System.out.println( test );
NodeId nid = new NodeId(2,"PowerHub.LU1.WatchdogDevelopment");
DataValue watchdog = client.readValue(nid);
System.out.println( watchdog.getValue().toNumber() );
client.disconnect();
So the setup is correct.

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

Moderators: support
Time to create page: 0.051 seconds