I am new with OPC-UA. 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.
public void Connect(string endpointUrl)
{
AppSession.UserIdentity = new UserIdentity();
AppSession.SessionName = "urn:ACGIDT053:UnifiedAutomation:UaExpert";
//AppSession.Application.CertificateGroups[0];
//string endpointUrl = "opc.tcp://212.43.72.27:51510/UA/WipotecServer/";
AppSession.Connect(endpointUrl, SecuritySelection.None);
ICertificate certificateServer = SecurityUtils.LoadCertificate(AppSession.EndpointDescription.ServerCertificate);
AppSession.Application.TrustedStore.Add(certificateServer, true);
/// [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(string.Empty, TypeInfo.Scalars.String), new Variant(a,TypeInfo.Scalars.UInt32), new Variant(string.Empty, TypeInfo.Scalars.String),
new Variant(null, TypeInfo.Arrays.ExtensionObject), new Variant(string.Empty, TypeInfo.Scalars.String)
};
/// [Step 2]
List<StatusCode> inputArgumentErrors;
List<Variant> outputArguments = null;
// call the method on the server.
StatusCode error = AppSession.Call(
objectId,
methodId,
inputArguments,
out inputArgumentErrors,
out outputArguments);
AppSession.Disconnect();
}
There are no exceptions that are returned in the code by the server all input arguments are good and so is the error status.
UPDATE: The filter expression should be: (ip.src == 172.16.55.144 && ip.dst == 212.43.72.27) || (ip.dst == 172.16.55.144 && ip.src == 212.43.72.27) Please find below links for the packets from Wireshark: uaexpert: https://1drv.ms/u/s!ArxC3dVLzVTqhUGxsO1aDssb45er?e=tBcBRz localClient: https://1drv.ms/u/s!ArxC3dVLzVTqhUANVvKmHG5ULW6_?e=cAO5C8
UPDATE: Code updated as per suggestions from comments. Packets from wireshark for updated code: https://1drv.ms/u/s!ArxC3dVLzVTqhUIuqudrkrjMn8kn?e=fAZOtd