You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling a method whose output argument[0] is an array of custom structure dataType values, the corresponding output argument returns a slice of []*ua.ExtensionObject, where the ua.ExtensionObject.Value() == nil for each slice element. The same method called from e.g. UaExpert returns the correct decoded custom structure; that is the method returns the correct []*ua.ExtensionObject. Tested with multiple clients on multiple custom OPC UA servers. As a result, the ExtensionObject value cannot be decoded.
pseudo code:
...
oID := objectNodeId
mID := methodNodeId // method with zero input arguments; one output argument
req := &ua.CallMethodRequest{
ObjectID: oID,
MethodID: mID,
InputArguments: []*ua.Variant{},
}
resp, err := c.Call(ctx, req)
if err != nil {
log.Fatal(err)
}
if got, want := resp.StatusCode, ua.StatusOK; got != want {
log.Fatalf("got status %v want %v", got, want)
}
out := resp.OutputArguments[0].Value()
// first output argument shall be an array of values of a custom structure dataType;
// thus encoded as extensionObjects
extObjects, ok := out.([]*ua.ExtensionObject) // works up to here;
// ...error handling omitted
for _, extObj range extObjects {
value := extObj.Value(). // value is always nil??
}