OPC Studio User's Guide and Reference
InputTypeCodes Property (UACallArguments)
Example 



OpcLabs.EasyOpcUA Assembly > OpcLabs.EasyOpc.UA.OperationModel Namespace > UACallArguments Class : InputTypeCodes Property
Specifies the type codes that should be used when passing the input arguments to the server.
Syntax
'Declaration
 
<CanBeNullAttribute()>
<DefaultValueAttribute("")>
<IgnoreDataMemberAttribute()>
<XmlIgnoreAttribute()>
Public Property InputTypeCodes As TypeCode()
'Usage
 
Dim instance As UACallArguments
Dim value() As TypeCode
 
instance.InputTypeCodes = value
 
value = instance.InputTypeCodes
[CanBeNull()]
[DefaultValue("")]
[IgnoreDataMember()]
[XmlIgnore()]
public TypeCode[] InputTypeCodes {get; set;}
[CanBeNull()]
[DefaultValue("")]
[IgnoreDataMember()]
[XmlIgnore()]
public:
property array<TypeCode>^ InputTypeCodes {
   array<TypeCode>^ get();
   void set (    array<TypeCode>^ value);
}

Property Value

The type codes that should be used when passing the input arguments to the server.
Remarks

Element positions in this property correspond to argument positions in InputArguments.

A null value in this property, a System.TypeCode.Empty value in specific element, or a missing element (when there is fewer types than arguments) means that the input argument will be passed to the server without change.

Example

COM

// 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 .

#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();
    }
}
// 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 .

class procedure CallMultipleMethods.Main;
var
  Arguments: OleVariant;
  CallArguments1, CallArguments2: _UACallArguments;
  Client: EasyUAClient;
  I, J: Cardinal;
  Inputs1, Inputs2: OleVariant;
  Outputs: OleVariant;
  Result: _ValueArrayResult;
  Results: OleVariant;
  TypeCodes1, TypeCodes2: OleVariant;
begin
  Inputs1 := VarArrayCreate([0, 10], varVariant);
  Inputs1[0] := False;
  Inputs1[1] := 1;
  Inputs1[2] := 2;
  Inputs1[3] := 3;
  Inputs1[4] := 4;
  Inputs1[5] := 5;
  Inputs1[6] := 6;
  Inputs1[7] := 7;
  Inputs1[8] := 8;
  Inputs1[9] := 9;
  Inputs1[10] := 10;

  TypeCodes1 := VarArrayCreate([0, 10], varVariant);
  TypeCodes1[0] := TypeCode_Boolean;
  TypeCodes1[1] := TypeCode_SByte;
  TypeCodes1[2] := TypeCode_Byte;
  TypeCodes1[3] := TypeCode_Int16;
  TypeCodes1[4] := TypeCode_UInt16;
  TypeCodes1[5] := TypeCode_Int32;
  TypeCodes1[6] := TypeCode_UInt32;
  TypeCodes1[7] := TypeCode_Int64;
  TypeCodes1[8] := TypeCode_UInt64;
  TypeCodes1[9] := TypeCode_Single;
  TypeCodes1[10] := TypeCode_Double;

  CallArguments1 := CoUACallArguments.Create;
  CallArguments1.EndpointDescriptor.UrlString := 
    //'http://opcua.demo-this.com:51211/UA/SampleServer';
    'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer';
  CallArguments1.NodeDescriptor.NodeId.ExpandedText := 'nsu=http://test.org/UA/Data/ ;i=10755';
  CallArguments1.MethodNodeDescriptor.NodeId.ExpandedText := 'nsu=http://test.org/UA/Data/ ;i=10756';
  CallArguments1.InputArguments := PSafeArray(TVarData(Inputs1).VArray);
  CallArguments1.InputTypeCodes := PSafeArray(TVarData(TypeCodes1).VArray);

  Inputs2 := VarArrayCreate([0, 11], varVariant);
  Inputs2[0] := False;
  Inputs2[1] := 1;
  Inputs2[2] := 2;
  Inputs2[3] := 3;
  Inputs2[4] := 4;
  Inputs2[5] := 5;
  Inputs2[6] := 6;
  Inputs2[7] := 7;
  Inputs2[8] := 8;
  Inputs2[9] := 9;
  Inputs2[10] := 10;
  Inputs2[11] := 'eleven';

  TypeCodes2 := VarArrayCreate([0, 11], varVariant);
  TypeCodes2[0] := TypeCode_Boolean;
  TypeCodes2[1] := TypeCode_SByte;
  TypeCodes2[2] := TypeCode_Byte;
  TypeCodes2[3] := TypeCode_Int16;
  TypeCodes2[4] := TypeCode_UInt16;
  TypeCodes2[5] := TypeCode_Int32;
  TypeCodes2[6] := TypeCode_UInt32;
  TypeCodes2[7] := TypeCode_Int64;
  TypeCodes2[8] := TypeCode_UInt64;
  TypeCodes2[9] := TypeCode_Single;
  TypeCodes2[10] := TypeCode_Double;
  TypeCodes2[11] := TypeCode_String;

  CallArguments2 := CoUACallArguments.Create;
  CallArguments2.EndpointDescriptor.UrlString := 
    //'http://opcua.demo-this.com:51211/UA/SampleServer';
    'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer';
  CallArguments2.NodeDescriptor.NodeId.ExpandedText := 'nsu=http://test.org/UA/Data/ ;i=10755';
  CallArguments2.MethodNodeDescriptor.NodeId.ExpandedText := 'nsu=http://test.org/UA/Data/ ;i=10774';
  CallArguments2.InputArguments := PSafeArray(TVarData(Inputs2).VArray);
  CallArguments2.InputTypeCodes := PSafeArray(TVarData(TypeCodes2).VArray);

  Arguments := VarArrayCreate([0, 1], varVariant);
  Arguments[0] := CallArguments1;
  Arguments[1] := CallArguments2;

  // Instantiate the client object
  Client := CoEasyUAClient.Create;

  // Perform the operation
  TVarData(Results).VType := varArray or varVariant;
  TVarData(Results).VArray := PVarArray(Client.CallMultipleMethods(
    PSafeArray(TVarData(Arguments).VArray)));

  // Display results
  for I := VarArrayLowBound(Results, 1) to VarArrayHighBound(Results, 1) do
  begin
    WriteLn;
    WriteLn('results(', I, '):');
    Result := IInterface(Results[I]) as _ValueArrayResult;

    if Result.Exception = nil then
      begin
        TVarData(Outputs).VType := varArray or varVariant;
        TVarData(Outputs).VArray := PVarArray(Result.ValueArray);
        for J := VarArrayLowBound(Outputs, 1) to VarArrayHighBound(Outputs, 1) do
          try
            WriteLn('    ', 'outputs(', J, '): ', Outputs[J]);
          except
            on EVariantError do WriteLn('*** Error displaying the value');
          end;
      end
    else
      WriteLn('*** Error: ', Result.Exception.ToString);
  end;
end;
// 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 .

class procedure CallMultipleMethods.Main;
var
  Arguments: OleVariant;
  CallArguments1, CallArguments2: _UACallArguments;
  Client: OpcLabs_EasyOpcUA_TLB._EasyUAClient;
  I, J: Cardinal;
  Inputs1, Inputs2: OleVariant;
  Outputs: OleVariant;
  Result: _ValueArrayResult;
  Results: OleVariant;
  TypeCodes1, TypeCodes2: OleVariant;
begin
  Inputs1 := VarArrayCreate([0, 10], varVariant);
  Inputs1[0] := False;
  Inputs1[1] := 1;
  Inputs1[2] := 2;
  Inputs1[3] := 3;
  Inputs1[4] := 4;
  Inputs1[5] := 5;
  Inputs1[6] := 6;
  Inputs1[7] := 7;
  Inputs1[8] := 8;
  Inputs1[9] := 9;
  Inputs1[10] := 10;

  TypeCodes1 := VarArrayCreate([0, 10], varVariant);
  TypeCodes1[0] := TypeCode_Boolean;
  TypeCodes1[1] := TypeCode_SByte;
  TypeCodes1[2] := TypeCode_Byte;
  TypeCodes1[3] := TypeCode_Int16;
  TypeCodes1[4] := TypeCode_UInt16;
  TypeCodes1[5] := TypeCode_Int32;
  TypeCodes1[6] := TypeCode_UInt32;
  TypeCodes1[7] := TypeCode_Int64;
  TypeCodes1[8] := TypeCode_UInt64;
  TypeCodes1[9] := TypeCode_Single;
  TypeCodes1[10] := TypeCode_Double;

  CallArguments1 := CoUACallArguments.Create;
  CallArguments1.EndpointDescriptor.UrlString := 
    //'http://opcua.demo-this.com:51211/UA/SampleServer';
    //'https://opcua.demo-this.com:51212/UA/SampleServer/';
    'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer';
  CallArguments1.NodeDescriptor.NodeId.ExpandedText := 'nsu=http://test.org/UA/Data/ ;i=10755';
  CallArguments1.MethodNodeDescriptor.NodeId.ExpandedText := 'nsu=http://test.org/UA/Data/ ;i=10756';
  CallArguments1.InputArguments := PSafeArray(TVarData(Inputs1).VArray);
  CallArguments1.InputTypeCodes := TypeCodes1;

  Inputs2 := VarArrayCreate([0, 11], varVariant);
  Inputs2[0] := False;
  Inputs2[1] := 1;
  Inputs2[2] := 2;
  Inputs2[3] := 3;
  Inputs2[4] := 4;
  Inputs2[5] := 5;
  Inputs2[6] := 6;
  Inputs2[7] := 7;
  Inputs2[8] := 8;
  Inputs2[9] := 9;
  Inputs2[10] := 10;
  Inputs2[11] := 'eleven';

  TypeCodes2 := VarArrayCreate([0, 11], varVariant);
  TypeCodes2[0] := TypeCode_Boolean;
  TypeCodes2[1] := TypeCode_SByte;
  TypeCodes2[2] := TypeCode_Byte;
  TypeCodes2[3] := TypeCode_Int16;
  TypeCodes2[4] := TypeCode_UInt16;
  TypeCodes2[5] := TypeCode_Int32;
  TypeCodes2[6] := TypeCode_UInt32;
  TypeCodes2[7] := TypeCode_Int64;
  TypeCodes2[8] := TypeCode_UInt64;
  TypeCodes2[9] := TypeCode_Single;
  TypeCodes2[10] := TypeCode_Double;
  TypeCodes2[11] := TypeCode_String;

  CallArguments2 := CoUACallArguments.Create;
  CallArguments2.EndpointDescriptor.UrlString := 
    //'http://opcua.demo-this.com:51211/UA/SampleServer';
    //'https://opcua.demo-this.com:51212/UA/SampleServer/';
    'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer';
  CallArguments2.NodeDescriptor.NodeId.ExpandedText := 'nsu=http://test.org/UA/Data/ ;i=10755';
  CallArguments2.MethodNodeDescriptor.NodeId.ExpandedText := 'nsu=http://test.org/UA/Data/ ;i=10774';
  CallArguments2.InputArguments := PSafeArray(TVarData(Inputs2).VArray);
  CallArguments2.InputTypeCodes := TypeCodes2;

  Arguments := VarArrayCreate([0, 1], varVariant);
  Arguments[0] := CallArguments1;
  Arguments[1] := CallArguments2;

  // Instantiate the client object
  Client := CoEasyUAClient.Create;

  // Perform the operation
  TVarData(Results).VType := varArray or varVariant;
  TVarData(Results).VArray := PVarArray(Client.CallMultipleMethods(
    Arguments));

  // Display results
  for I := VarArrayLowBound(Results, 1) to VarArrayHighBound(Results, 1) do
  begin
    WriteLn;
    WriteLn('results(', I, '):');
    Result := IInterface(Results[I]) as _ValueArrayResult;

    if Result.Exception = nil then
      begin
        Outputs := Result.ValueArray;
        for J := VarArrayLowBound(Outputs, 1) to VarArrayHighBound(Outputs, 1) do
          WriteLn('    ', 'outputs(', J, '): ', Outputs[J]);
      end
    else
      WriteLn('*** Failure: ', Result.Exception.ToString);
  end;

  VarClear(Results);
  VarClear(TypeCodes2);
  VarClear(TypeCodes1);
  VarClear(Arguments);
end;
REM This example shows how to call multiple methods, and pass arguments to and from them.
REM
REM Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Public Sub CallMultipleMethods_Main_Command_Click()
    OutputText = ""

    Dim inputs1(10)
    inputs1(0) = False
    inputs1(1) = 1
    inputs1(2) = 2
    inputs1(3) = 3
    inputs1(4) = 4
    inputs1(5) = 5
    inputs1(6) = 6
    inputs1(7) = 7
    inputs1(8) = 8
    inputs1(9) = 9
    inputs1(10) = 10

    Dim typeCodes1(10)
    typeCodes1(0) = 3    ' TypeCode.Boolean
    typeCodes1(1) = 5    ' TypeCode.SByte
    typeCodes1(2) = 6    ' TypeCode.Byte
    typeCodes1(3) = 7    ' TypeCode.Int16
    typeCodes1(4) = 8    ' TypeCode.UInt16
    typeCodes1(5) = 9    ' TypeCode.Int32
    typeCodes1(6) = 10   ' TypeCode.UInt32
    typeCodes1(7) = 11   ' TypeCode.Int64
    typeCodes1(8) = 12   ' TypeCode.UInt64
    typeCodes1(9) = 13   ' TypeCode.Single
    typeCodes1(10) = 14  ' TypeCode.Double

    Dim CallArguments1 As New UACallArguments
    CallArguments1.endpointDescriptor.UrlString = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
    CallArguments1.nodeDescriptor.NodeId.expandedText = "nsu=http://test.org/UA/Data/ ;i=10755"
    CallArguments1.MethodNodeDescriptor.NodeId.expandedText = "nsu=http://test.org/UA/Data/ ;i=10756"
    ' Use SetXXXX methods instead of array-type property setters in Visual Basic 6.0
    CallArguments1.SetInputArguments inputs1
    CallArguments1.SetInputTypeCodes typeCodes1

    Dim inputs2(11)
    inputs2(0) = False
    inputs2(1) = 1
    inputs2(2) = 2
    inputs2(3) = 3
    inputs2(4) = 4
    inputs2(5) = 5
    inputs2(6) = 6
    inputs2(7) = 7
    inputs2(8) = 8
    inputs2(9) = 9
    inputs2(10) = 10
    inputs2(11) = "eleven"

    Dim typeCodes2(11)
    typeCodes2(0) = 3    ' TypeCode.Boolean
    typeCodes2(1) = 5    ' TypeCode.SByte
    typeCodes2(2) = 6    ' TypeCode.Byte
    typeCodes2(3) = 7    ' TypeCode.Int16
    typeCodes2(4) = 8    ' TypeCode.UInt16
    typeCodes2(5) = 9    ' TypeCode.Int32
    typeCodes2(6) = 10   ' TypeCode.UInt32
    typeCodes2(7) = 11   ' TypeCode.Int64
    typeCodes2(8) = 12   ' TypeCode.UInt64
    typeCodes2(9) = 13   ' TypeCode.Single
    typeCodes2(10) = 14  ' TypeCode.Double
    typeCodes2(11) = 18  ' TypeCode.String

    Dim CallArguments2 As New UACallArguments
    CallArguments2.endpointDescriptor.UrlString = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
    CallArguments2.nodeDescriptor.NodeId.expandedText = "nsu=http://test.org/UA/Data/ ;i=10755"
    CallArguments2.MethodNodeDescriptor.NodeId.expandedText = "nsu=http://test.org/UA/Data/ ;i=10774"
    ' Use SetXXXX methods instead of array-type property setters in Visual Basic 6.0
    CallArguments2.SetInputArguments inputs2
    CallArguments2.SetInputTypeCodes typeCodes2

    Dim arguments(1) As Variant
    Set arguments(0) = CallArguments1
    Set arguments(1) = CallArguments2

    ' Instantiate the client object
    Dim Client As New EasyUAClient

    ' Perform the operation
    Dim results As Variant
    results = Client.CallMultipleMethods(arguments)

    ' Display results
    Dim i: For i = LBound(results) To UBound(results)
        OutputText = OutputText & vbCrLf
        OutputText = OutputText & "results(" & i & "):" & vbCrLf
        Dim Result As ValueArrayResult: Set Result = results(i)

        If Result.Exception Is Nothing Then
            Dim outputs As Variant: outputs = Result.ValueArray
            Dim j: For j = LBound(outputs) To UBound(outputs)
                On Error Resume Next
                OutputText = OutputText & Space(4) & "outputs(" & j & "): " & outputs(j) & vbCrLf
                If Err <> 0 Then OutputText = OutputText & Space(4) & "*** Error" & vbCrLf ' occurrs with types not recognized by VB6
                On Error GoTo 0
            Next
        Else
            OutputText = OutputText & "*** Error: " & Result.Exception & vbCrLf
        End If
    Next
End Sub
Rem This example shows how to call multiple methods, and pass arguments to and from them.
Rem
Rem Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Option Explicit

Dim inputs1(10)
inputs1(0) = False
inputs1(1) = 1
inputs1(2) = 2
inputs1(3) = 3
inputs1(4) = 4
inputs1(5) = 5
inputs1(6) = 6
inputs1(7) = 7
inputs1(8) = 8
inputs1(9) = 9
inputs1(10) = 10

Dim typeCodes1(10)
typeCodes1(0) = 3    ' TypeCode.Boolean
typeCodes1(1) = 5    ' TypeCode.SByte
typeCodes1(2) = 6    ' TypeCode.Byte
typeCodes1(3) = 7    ' TypeCode.Int16
typeCodes1(4) = 8    ' TypeCode.UInt16
typeCodes1(5) = 9    ' TypeCode.Int32
typeCodes1(6) = 10   ' TypeCode.UInt32
typeCodes1(7) = 11   ' TypeCode.Int64
typeCodes1(8) = 12   ' TypeCode.UInt64
typeCodes1(9) = 13   ' TypeCode.Single
typeCodes1(10) = 14  ' TypeCode.Double

Dim CallArguments1: Set CallArguments1 = CreateObject("OpcLabs.EasyOpc.UA.OperationModel.UACallArguments")
CallArguments1.EndpointDescriptor.UrlString = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
CallArguments1.NodeDescriptor.NodeId.ExpandedText = "nsu=http://test.org/UA/Data/ ;i=10755"
CallArguments1.MethodNodeDescriptor.NodeId.ExpandedText = "nsu=http://test.org/UA/Data/ ;i=10756"
CallArguments1.InputArguments = inputs1
CallArguments1.InputTypeCodes = typeCodes1

Dim inputs2(11)
inputs2(0) = False
inputs2(1) = 1
inputs2(2) = 2
inputs2(3) = 3
inputs2(4) = 4
inputs2(5) = 5
inputs2(6) = 6
inputs2(7) = 7
inputs2(8) = 8
inputs2(9) = 9
inputs2(10) = 10
inputs2(11) = "eleven"

Dim typeCodes2(11)
typeCodes2(0) = 3    ' TypeCode.Boolean
typeCodes2(1) = 5    ' TypeCode.SByte
typeCodes2(2) = 6    ' TypeCode.Byte
typeCodes2(3) = 7    ' TypeCode.Int16
typeCodes2(4) = 8    ' TypeCode.UInt16
typeCodes2(5) = 9    ' TypeCode.Int32
typeCodes2(6) = 10   ' TypeCode.UInt32
typeCodes2(7) = 11   ' TypeCode.Int64
typeCodes2(8) = 12   ' TypeCode.UInt64
typeCodes2(9) = 13   ' TypeCode.Single
typeCodes2(10) = 14  ' TypeCode.Double
typeCodes2(11) = 18  ' TypeCode.String

Dim CallArguments2: Set CallArguments2 = CreateObject("OpcLabs.EasyOpc.UA.OperationModel.UACallArguments")
CallArguments2.EndpointDescriptor.UrlString = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
CallArguments2.NodeDescriptor.NodeId.ExpandedText = "nsu=http://test.org/UA/Data/ ;i=10755"
CallArguments2.MethodNodeDescriptor.NodeId.ExpandedText = "nsu=http://test.org/UA/Data/ ;i=10774"
CallArguments2.InputArguments = inputs2
CallArguments2.InputTypeCodes = typeCodes2

Dim arguments(1)
Set arguments(0) = CallArguments1
Set arguments(1) = CallArguments2

' Instantiate the client object
Dim Client: Set Client = CreateObject("OpcLabs.EasyOpc.UA.EasyUAClient")

' Perform the operation
Dim results: results = Client.CallMultipleMethods(arguments)

' Display results
Dim i: For i = LBound(results) To UBound(results)
    WScript.Echo
    WScript.Echo "results(" & i & "):"
    Dim Result: Set Result = results(i)

    If Result.Exception Is Nothing Then
        Dim outputs: outputs = Result.ValueArray
        Dim j: For j = LBound(outputs) To UBound(outputs)
            On Error Resume Next
            WScript.Echo Space(4) & "outputs(" & j & "): " & outputs(j)
            If Err <> 0 Then WScript.Echo Space(4) & "*** Error"   ' occurrs with types not recognized by VBScript
            On Error Goto 0
        Next
    Else
        WScript.Echo "*** Error: " & Result.Exception
    End If
Next
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