Azure / Industrial-IoT

Azure Industrial IoT Platform
MIT License
526 stars 214 forks source link

500 Error in the OPCTwin API when calling an OPC UA Method #633

Closed Nsteel closed 2 years ago

Nsteel commented 4 years ago

We deployed the Industrial IoT stack using the deployment script provided in the repository. We are using the OPC Twin REST API to call some methods of an OPC UA server that is implementing the OPC UA companion specification for Machine Vision. To call those methods we need to pass and receive complex datatypes as per the companion specification. Unfortunately since a couple of weeks ago, we are getting a 500 error whenever we try to call one of the methods mentioned before (method GetResultListFiltered), the other method calls still working as expected. Additional Info: We are able to call the GetResultListFiltered method using UaExpert without any issues.

OPCTwin API endpoint used https://{{OPC-SERVICEURL}}/twin/v2/call/{{endpointID}}

Request body

{
    "header": {
        "diagnostics": {
            "level": "Verbose"
        }
    },
    "methodBrowsePath": null,
    "methodId": "urn:NodeOPCUA-Server-default#s=VisionSystem-ResultManagement-GetResultListFiltered",
    "objectBrowsePath": null,
    "objectId": "urn:NodeOPCUA-Server-default#s=VisionSystem-ResultManagement",
    "arguments": [
        {
            "dataType": "http://opcfoundation.org/UA/MachineVision#i=3009",
            "value": "1"
        },
        {
            "dataType": "http://opcfoundation.org/UA/MachineVision#i=3015",
            "value": {
                "Body": {
                    "Id": ""
                }
            }
        },
        {
            "dataType": "http://opcfoundation.org/UA/MachineVision#i=3004",
            "value": {
                "Body": {
                    "Id": ""
                }
            }
        },
        {
            "dataType": "http://opcfoundation.org/UA/MachineVision#i=3002",
            "value": {
                "Body": {
                    "Id": ""
                }
            }
        },
        {
            "dataType": "http://opcfoundation.org/UA/MachineVision#i=3013",
            "value": {
                "Body": {
                    "Id": ""
                }
            }
        },
        {
            "dataType": "http://opcfoundation.org/UA/MachineVision#i=3008",
            "value": {
                "Body": {
                    "Id": ""
                }
            }
        },
        {
            "dataType": "http://opcfoundation.org/UA/MachineVision#i=3008",
            "value": {
                "Body": {
                    "Id": ""
                }
            }
        },
        {
            "dataType": "http://opcfoundation.org/UA/MachineVision#i=3003",
            "value": {
                "Body": {
                    "Id": ""
                }
            }
        },
        {
            "dataType": "http://opcfoundation.org/UA/MachineVision#i=3016",
            "value": {
                "Body": {
                    "Id": ""
                }
            }
        },
        {
            "dataType": "UInt32",
            "value": "10"
        },
        {
            "dataType": "UInt32",
            "value": "0"
        },
        {
            "dataType": "Int32",
            "value": "60"
        }
    ]
}

Response body

{
    "Result": 500,
    "ResponsePayload": "{\"ClassName\":\"System.FormatException\",\"Message\":null,\"Data\":null,\"InnerException\":{},\"HelpURL\":null,\"StackTraceString\":\"   at Microsoft.Azure.IIoT.OpcUa.Protocol.Services.ClientServices.ExecuteServiceAsync[T](ConnectionModel connection, CredentialModel elevation, Int32 priority, Func`2 service, Nullable`1 timeout, CancellationToken ct, Func`2 handler)\\n   at Microsoft.Azure.IIoT.Modules.OpcUa.Twin.Controllers.EndpointMethodsController.MethodCallAsync(MethodCallRequestApiModel request) in D:\\\\a\\\\1\\\\s\\\\modules\\\\src\\\\Microsoft.Azure.IIoT.Modules.OpcUa.Twin\\\\src\\\\Controllers\\\\EndpointMethodsController.cs:line 182\",\"RemoteStackTraceString\":null,\"RemoteStackIndex\":0,\"ExceptionMethod\":null,\"HResult\":-2146233033,\"Source\":\"System.Private.CoreLib\",\"WatsonBuckets\":null,\"Exception\":\"FormatException\",\"CausedBy\":{\"Message\":\"Unexpected error processing response.\",\"Exception\":\"ServiceResultException\"}}",
    "Message": "Response 500 : {\"ClassName\":\"System.FormatException\",\"Message\":null,\"Data\":null,\"InnerException\":{},\"HelpURL\":null,\"StackTraceString\":\"   at Microsoft.Azure.IIoT.OpcUa.Protocol.Services.ClientServices.ExecuteServiceAsync[T](ConnectionModel connection, CredentialModel elevation, Int32 priority, Func`2 service, Nullable`1 timeout, CancellationToken ct, Func`2 handler)\\n   at Microsoft.Azure.IIoT.Modules.OpcUa.Twin.Controllers.EndpointMethodsController.MethodCallAsync(MethodCallRequestApiModel request) in D:\\\\a\\\\1\\\\s\\\\modules\\\\src\\\\Microsoft.Azure.IIoT.Modules.OpcUa.Twin\\\\src\\\\Controllers\\\\EndpointMethodsController.cs:line 182\",\"RemoteStackTraceString\":null,\"RemoteStackIndex\":0,\"ExceptionMethod\":null,\"HResult\":-2146233033,\"Source\":\"System.Private.CoreLib\",\"WatsonBuckets\":null,\"Exception\":\"FormatException\",\"CausedBy\":{\"Message\":\"Unexpected error processing response.\",\"Exception\":\"ServiceResultException\"}}",
    "Data": {},
    "Source": "Microsoft.Azure.IIoT.Core",
    "HResult": -2146233088,
    "Exception": "MethodCallStatusException"
}

Services running on edge device

cristipogacean commented 2 years ago

closing due to inactivity.