Login  •  Register


SDKs call method does not return the expected output

Questions regarding the use of the .NET SDK 2.0 for Server or Client development or integration into customer products ...

SDKs call method does not return the expected output

Postby anurage0 » 13 Aug 2019, 06:52

Currently after studying the demos and examples provided by Unified Automation documentation. I was able to write a simple code which connects to a server end point and calls a method. But sadly that method does not return the expected out. Moreover, if I call the same method on the same server and the same URL with the same parameters through the UAExpert I get the expected result. I am at my wits end and would appreciate any help below is the code that I have currently written.
Do let me know if i have missed anything in the code.
Code: Select all
public void Connect(string endpointUrl)
        {
            AppSession.UserIdentity = new UserIdentity();
            AppSession.Connect(endpointUrl, SecuritySelection.None);           
            /// [Step 1]
            // parse the object id.
            NodeId objectId = NodeId.Parse("ns=2;i=15108");
            // get the selected method id.           
            NodeId methodId = NodeId.Parse("ns=2;i=15057");
            // get input arguments.
            UInt32 a = 2;
            List<Variant> inputArguments = new List<Variant>
            {
                new Variant(), new Variant(a,TypeInfo.Scalars.UInt32), new Variant(),
                new Variant(), new Variant()
            };
            /// [Step 2]
            List<StatusCode> inputArgumentErrors = null;
            List<Variant> outputArguments = null;
            // call the method on the server.
            StatusCode error = AppSession.Call(
                objectId,
                methodId,
                inputArguments,
                new RequestSettings() { DiagnosticsMasks = DiagnosticsMasks.None, OperationTimeout = 10000 },
                out inputArgumentErrors,
                out outputArguments);
        }


There are no exceptions that are returned in the code by the server all input arguments are good and so is the error status.
anurage0
Jr. Member
Jr. Member
 
Posts: 1
Joined: 13 Aug 2019, 06:43

Return to .NET based OPC UA SDK

Who is online

Users browsing this forum: No registered users and 0 guests