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.

Exceptions calling CallMethod

More
01 May 2020 06:54 #8445 by support
Hello,
thank you for letting to know. I was about to accept your offer with sending the servers, but it is no longer necessary.

In OPC UA, many things are like RPC (remote procedure calls) to some OOP (object oriented programming) system. In CallMethod, the "node id" is then similar to the "object" in OOP you call the method on ("this" pointer), and the "method id" corresponds to the method name/identifier.

I also do not know the cause of the difference, for that it would be necessary to analyze it in depth.

Best regards

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

More
01 May 2020 04:19 #8444 by sjscheider
OK, I figured out what the issue was. I had the "objectNodeDescriptor" and "methodNodeDescriptor" swapped. What I don't understand fully is why it worked on the old server but not the new.

The "objectNodeDescriptor" is the node of the folder/object/container that method is contained in.

The "methodNodeDescriptor" is the actual node of the method.

Thanks!

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

More
30 Apr 2020 18:46 #8443 by sjscheider
Thanks for the reply. I think what I'm really struggling with is not understanding the difference between "objectNodeDescriptor" and "methodNodeDescriptor". Can you please explain this to me? I really think I just am using the incorrect node ids but I don't understand which ones to use for each value.

Exploring the node is UaExport, the node ids, namespace indexes and identifiers all seem to be the same on the old and the new. I believe the namespace URLs have changed between version yet I was told nothing changed. But I can see the difference when I browse the nodes. Here are the node ids of the method, SetUtcDateTime.
Method / VariableOld Server Node IdsNew Server Node Ids
SetUtcDateTimens=3;i=6ns=3;i=6
InputArgumentsns=3;i=7ns=3;i=7
OutputArgumentsns=3;i=8ns=3;i=8

From the testing I've done, it appears the CallMethod() call works on the old server because it was the only method under the node id "ns=3;i=1". But in the new server there are 6 additional methods under this node id. Does that make sense to you?

If you are open to it, we are willing to share the two OPC-UA servers so you can see what I'm seeing. Both are simple exes, not install needed.

Looking at your example on how to use CallMethod(), I noticed you use "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer". When I try to browse this server via UaExport, it takes forever and I often get timeouts. Is there a better way to browse this server? Can it be easily installed locally? My thought is that if I could browse your demo server I may have a better understanding of how this call works.

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

More
30 Apr 2020 06:07 #8439 by support
For completeness, the situation can also be other way around: The new server might have kept the namespaces indexes, but changed the namespace URIs. Actually, from the error codes you are getting, it might very well be the case.

In such case, for test, you would rather remove the namespace URIs from all your node IDs, or replace them with the proper new URIs. But if the server vendor did this change, they have completely misunderstood the concept of how OPC UA identifies nodes.

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

More
30 Apr 2020 06:04 - 30 Apr 2020 06:04 #8438 by support
Hello,
there can be various reasons and we will look deeper if needed, but first thing that comes to my mind is this:

Does the new server have the namespaces at the same indexes as the old server? Only namespace URIs are guaranteed to stay valid; the indexes (except 0 and possibly 1) can change - even between sessions, not to talk about server config changes or even version changes! See opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...indices%20in%20Node%20Ids.html .

At some places, you specify the node using both the namespace URI and the index - which is good (the index can even be omitted). But at other places, you specify the method using just the index: "ns=3;i=1". If the method is no longer at namespace index 3, nothing will work. The recommendation is always to use namespace URI (although you will see the Internet full of examples with namespace indexes: they are all incorrect, unless you have full control of the server).

Best regards
Last edit: 30 Apr 2020 06:04 by support.

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

More
30 Apr 2020 05:23 #8437 by sjscheider
We have code that has been running for 6+ months that using CallMethod() to call a method on the OPC-AU server. Recently we received a new version of the OPC-UA server and now the call fails using the same code as before. If we attempt to make the call in UaExport, the method works on the old and the new OPC-UA server. So I'm wondering if there is something that I'm going wrong.

All 3 of the calls work against the old server. All of these call are calling the same method just with different parameters.
object[] outputs = easyUaClient.CallMethod("opc.tcp://192.168.1.9:4840", "ns=3;i=6", "nsu=urn:VersumMaterials:UA:AP11CGGIIIController;i=1", inputs, typeCodes);
 
object[] outputs = easyUaClient.CallMethod("opc.tcp://192.168.1.9:4840", "nsu=urn:VersumMaterials:UA:AP11CGGIIIController ;ns=3;i=6", "ns=3;i=1", inputs, typeCodes);
 
object[] outputs = easyUaClient.CallMethod("opc.tcp://192.168.1.9:4840", "nsu=urn:VersumMaterials:UA:AP11CGGIIIController ;ns=3;i=6", "[ns=3;i=1].SetUtcDateTime", inputs, typeCodes);

On the new server, if I run the first option, I get the following exception:
An OPC-UA operation failure with error code -2139815936 (0x80750000) occurred, originating from 'OpcLabs.EasyOpcUA' and with depth of 1. The inner OPC-UA service exception with service result 'BadMethodInvalid' contains details about the problem. 
OpcLabs.EasyOpc.UA.OperationModel.UAException: An OPC-UA operation failure with error code -2139815936 (0x80750000) occurred, originating from 'OpcLabs.EasyOpcUA' and with depth of 1. The inner OPC-UA service exception with service result 'BadMethodInvalid' contains details about the problem.
 ---> OpcLabs.EasyOpc.UA.UACallServiceException: OPC-UA service result - An error specific to OPC-UA service occurred (status code: BadMethodInvalid). Details follow.
---- SERVICE RESULT ----
Status Code: {BadMethodInvalid} = 0x80750000 (2155151360)
 
+ The client method called was 'CallMultipleMethods'.

With the 2nd and 3rd, I get this exception.
An OPC-UA operation failure with error code -2144141312 (0x80330000) occurred, originating from 'OpcLabs.EasyOpcUA' and with depth of 1. The inner OPC-UA service exception with service result 'BadNodeIdInvalid' contains details about the problem. 
OpcLabs.EasyOpc.UA.OperationModel.UAException: An OPC-UA operation failure with error code -2144141312 (0x80330000) occurred, originating from 'OpcLabs.EasyOpcUA' and with depth of 1. The inner OPC-UA service exception with service result 'BadNodeIdInvalid' contains details about the problem.
 ---> OpcLabs.EasyOpc.UA.UACallServiceException: OPC-UA service result - An error specific to OPC-UA service occurred (status code: BadNodeIdInvalid). Details follow.
---- SERVICE RESULT ----
Status Code: {BadNodeIdInvalid} = 0x80330000 (2150825984)
 
+ The client method called was 'CallMultipleMethods'.

The signature of the method is the same on both servers. The code is identical.

Can you shed some light on what these exceptions mean? Do you have any suggestions on what the issue may be? Do you have any documentation on what the 2 parameters 'objectNodeDescriptor' & 'methodNodeDescriptor' should be? I looked and didn't see anything that made it evident to me what these values need to be.

Any help you can provide is greatly appreciated.

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

Moderators: support
Time to create page: 0.070 seconds