OPC Studio User's Guide and Reference
MethodNodeDescriptor Property (_UACallArguments)
Example 



View with Navigation Tools
OpcLabs.EasyOpcUA Assembly > OpcLabs.EasyOpc.UA.OperationModel.ComTypes Namespace > _UACallArguments Interface : MethodNodeDescriptor Property
Method Node Id. Identifies the method node in OPC server's address space.
Syntax
'Declaration
 
<NotNullAttribute()>
Property MethodNodeDescriptor As UANodeDescriptor
 
'Usage
 
Dim instance As _UACallArguments
Dim value As UANodeDescriptor
 
instance.MethodNodeDescriptor = value
 
value = instance.MethodNodeDescriptor

Property Value

The value of this property cannot be null (Nothing in Visual Basic).

Because there are implicit conversions to OpcLabs.EasyOpc.UA.Navigation.UANamedNodeDescriptor and OpcLabs.EasyOpc.UA.Navigation.UANamedNodePath from OpcLabs.EasyOpc.UA.UANodeDescriptor, in languages that support implicit conversion operators (such as C# or VB.NET), you can simply use the returned OpcLabs.EasyOpc.UA.UANodeDescriptor in any place where OpcLabs.EasyOpc.UA.Navigation.UANamedNodeDescriptor is expected (in this case the OpcLabs.EasyOpc.UA.UANodeDescriptor contains the final node descriptor) or where OpcLabs.EasyOpc.UA.Navigation.UANamedNodePath is expected (in this case the OpcLabs.EasyOpc.UA.UANodeDescriptor contains the base and only node in the named node path), and the corresponding OPC UA named node descriptor or named node path will be constructed automatically. When the implicit conversion operators are not supported (such as with Python.NET), you can use the FromUANodeDescriptor or FromUANodeDescriptor static method instead.

Exceptions
ExceptionDescription

A null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument.

This is a usage error, i.e. it will never occur (the exception will not be thrown) in a correctly written program. Your code should not catch this exception.

Remarks

The getter method of this property is pure, i.e. it does not have observable side effects.

Because the OpcLabs.EasyOpc.UA.UANodeDescriptor has implicit conversions from OpcLabs.EasyOpc.UA.AddressSpace.UANodeId, OpcLabs.EasyOpc.UA.AddressSpace.UANodeElement, OpcLabs.EasyOpc.UA.Navigation.UABrowsePath and System.String, in languages that support implicit conversion operators (such as C# or VB.NET), you can simply use a OpcLabs.EasyOpc.UA.AddressSpace.UANodeId object (representing the Id of the OPC UA node), a node element object (from OPC UA browsing), OpcLabs.EasyOpc.UA.Navigation.UABrowsePath object (representing OPC UA absolute browse path), or a string (with expanded node Id text) in place of OpcLabs.EasyOpc.UA.UANodeDescriptor value when setting this property, and the corresponding node descriptor will be constructed automatically. When the implicit conversion operators are not supported (such as with Python.NET), you can use the OpcLabs.EasyOpc.UA.UANodeDescriptor.FromString, OpcLabs.EasyOpc.UA.UANodeDescriptor.FromUABrowsePath, OpcLabs.EasyOpc.UA.UANodeDescriptor.FromUANodeElement or OpcLabs.EasyOpc.UA.UANodeDescriptor.FromUANodeId static method instead.

This member or type is for use from COM. It is not meant to be used from .NET or Python. Refer to the corresponding .NET member or type instead, if you are developing in .NET or Python.

Example
// This example shows how to call multiple methods, and pass arguments to and from them.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
// Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
// a commercial license in order to use Online Forums, and we reply to every post.

#include "stdafx.h"    // Includes "QuickOpc.h", and other commonly used files
#include <atlsafe.h>
#include "CallMultipleMethods.h"

namespace _EasyUAClient
{
    void CallMultipleMethods::Main()
    {
        // Initialize the COM library
        CoInitializeEx(NULL, COINIT_MULTITHREADED);
        {
            CComSafeArray<VARIANT> inputs1(11);
            inputs1.SetAt(0, _variant_t(false));
            inputs1.SetAt(1, _variant_t(1));
            inputs1.SetAt(2, _variant_t(2));
            inputs1.SetAt(3, _variant_t(3));
            inputs1.SetAt(4, _variant_t(4));
            inputs1.SetAt(5, _variant_t(5));
            inputs1.SetAt(6, _variant_t(6));
            inputs1.SetAt(7, _variant_t(7));
            inputs1.SetAt(8, _variant_t(8));
            inputs1.SetAt(9, _variant_t(9));
            inputs1.SetAt(10, _variant_t(10));

            CComSafeArray<VARIANT> typeCodes1(11);
            typeCodes1.SetAt(0, _variant_t(TypeCode_Boolean));
            typeCodes1.SetAt(1, _variant_t(TypeCode_SByte));
            typeCodes1.SetAt(2, _variant_t(TypeCode_Byte));
            typeCodes1.SetAt(3, _variant_t(TypeCode_Int16));
            typeCodes1.SetAt(4, _variant_t(TypeCode_UInt16));
            typeCodes1.SetAt(5, _variant_t(TypeCode_Int32));
            typeCodes1.SetAt(6, _variant_t(TypeCode_UInt32));
            typeCodes1.SetAt(7, _variant_t(TypeCode_Int64));
            typeCodes1.SetAt(8, _variant_t(TypeCode_UInt64));
            typeCodes1.SetAt(9, _variant_t(TypeCode_Single));
            typeCodes1.SetAt(10, _variant_t(TypeCode_Double));
            CComVariant vTypeCodes1(typeCodes1);

            _UACallArgumentsPtr CallArguments1Ptr(__uuidof(UACallArguments));
            CallArguments1Ptr->EndpointDescriptor->UrlString = 
                //L"http://opcua.demo-this.com:51211/UA/SampleServer";
                L"opc.tcp://opcua.demo-this.com:51210/UA/SampleServer";
                CallArguments1Ptr->NodeDescriptor->NodeId->ExpandedText = L"nsu=http://test.org/UA/Data/ ;i=10755";
            CallArguments1Ptr->MethodNodeDescriptor->NodeId->ExpandedText = L"nsu=http://test.org/UA/Data/ ;i=10756";
            CallArguments1Ptr->InputArguments = inputs1;
            CallArguments1Ptr->InputTypeCodes = vTypeCodes1;

            CComSafeArray<VARIANT> inputs2(12);
            inputs2.SetAt(0, _variant_t(false));
            inputs2.SetAt(1, _variant_t(1));
            inputs2.SetAt(2, _variant_t(2));
            inputs2.SetAt(3, _variant_t(3));
            inputs2.SetAt(4, _variant_t(4));
            inputs2.SetAt(5, _variant_t(5));
            inputs2.SetAt(6, _variant_t(6));
            inputs2.SetAt(7, _variant_t(7));
            inputs2.SetAt(8, _variant_t(8));
            inputs2.SetAt(9, _variant_t(9));
            inputs2.SetAt(10, _variant_t(10));
            inputs2.SetAt(11, _variant_t(L"eleven"));

            CComSafeArray<VARIANT> typeCodes2(12);
            typeCodes2.SetAt(0, _variant_t(TypeCode_Boolean));
            typeCodes2.SetAt(1, _variant_t(TypeCode_SByte));
            typeCodes2.SetAt(2, _variant_t(TypeCode_Byte));
            typeCodes2.SetAt(3, _variant_t(TypeCode_Int16));
            typeCodes2.SetAt(4, _variant_t(TypeCode_UInt16));
            typeCodes2.SetAt(5, _variant_t(TypeCode_Int32));
            typeCodes2.SetAt(6, _variant_t(TypeCode_UInt32));
            typeCodes2.SetAt(7, _variant_t(TypeCode_Int64));
            typeCodes2.SetAt(8, _variant_t(TypeCode_UInt64));
            typeCodes2.SetAt(9, _variant_t(TypeCode_Single));
            typeCodes2.SetAt(10, _variant_t(TypeCode_Double));
            typeCodes2.SetAt(11, _variant_t(TypeCode_String));
            CComVariant vTypeCodes2(typeCodes2);

            _UACallArgumentsPtr CallArguments2Ptr(__uuidof(UACallArguments));
            CallArguments2Ptr->EndpointDescriptor->UrlString = 
                //L"http://opcua.demo-this.com:51211/UA/SampleServer";
                L"opc.tcp://opcua.demo-this.com:51210/UA/SampleServer";
            CallArguments2Ptr->NodeDescriptor->NodeId->ExpandedText = L"nsu=http://test.org/UA/Data/ ;i=10755";
            CallArguments2Ptr->MethodNodeDescriptor->NodeId->ExpandedText = L"nsu=http://test.org/UA/Data/ ;i=10774";
            CallArguments2Ptr->InputArguments = inputs2;
            CallArguments2Ptr->InputTypeCodes = vTypeCodes2;

            CComSafeArray<VARIANT> arguments(2);
            arguments.SetAt(0, _variant_t((IDispatch*)CallArguments1Ptr));
            arguments.SetAt(1, _variant_t((IDispatch*)CallArguments2Ptr));
            CComVariant vArguments(arguments);

            // Instantiate the client object
            _EasyUAClientPtr ClientPtr(__uuidof(EasyUAClient));

            // Perform the operation
            CComSafeArray<VARIANT> results;
            results.Attach(ClientPtr->CallMultipleMethods(&vArguments));
    
            // Display results
            for (int i = results.GetLowerBound(); i <= results.GetUpperBound(); i++)
            {
                _tprintf(_T("\n"));
                _tprintf(_T("results(%d):\n"), i);
                _ValueArrayResultPtr ResultPtr = results[i];

                if (ResultPtr->Exception == NULL)
                {
                    CComVariant valueArray(ResultPtr->ValueArray);
                    CComSafeArray<VARIANT> outputs(valueArray.parray);
                    for (int j = outputs.GetLowerBound(); j <= outputs.GetUpperBound(); j++)
                    {
                        _variant_t output(outputs[j]);
                        _variant_t vString;
                        vString.ChangeType(VT_BSTR, &output);
                        _tprintf(_T("    outputs(d)s\n"), i, (LPCTSTR)CW2CT((_bstr_t)vString));
                    }
                }
                else
                    _tprintf(_T("*** Error: %s\n"), (LPCTSTR)CW2CT(ResultPtr->Exception->ToString));
            }
        }
         // Release all interface pointers BEFORE calling CoUninitialize()
        CoUninitialize();
    }
}
Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows

See Also