Hi,
i would like to return custom objects during a method call.
For example, given a class Test with two properties, how to return a variant with a custom object inside.
Test t = new Test { N = 1, S = "asdf" };
Variant v = new Variant(t1, TypeInfo.Construct(t1));
Although the variant object has its Value property correctly filled on the server side, the client receives a null object.
Is this is related to TypeInfo, right?
How to get around this problem?
How to return variant with custom object in a method call?
Moderator: uasdknet
-
- Full Member
- Posts: 6
- Joined: 16 Dec 2015, 15:41
- Support Team
- Hero Member
- Posts: 3072
- Joined: 18 Mar 2011, 15:09
Re: How to return variant with custom object in a method cal
We assume that the struture you want to return in the method call is know at compile time. We recommend to use UaModeler for modelling the structure und use the generated code in your server-application. Alternatively you can write the same code by hand. Please see the VectorAdd example in DemoServer application. This example shows how to use structures as input arguments and return structures as output arguments for method call.
You can test your code using UaExpert which supports Method calls taking structures as arguments.
You can test your code using UaExpert which supports Method calls taking structures as arguments.
Best regards
Unified Automation Support Team
Unified Automation Support Team