Overriding Write Service methods

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

Moderator: uasdknet

Post Reply
sudhapc
Hero Member
Hero Member
Posts: 28
Joined: 16 Oct 2018, 12:47

Overriding Write Service methods

Post by sudhapc »

Hi Team,

I have a requirement my client calls write service with multiple values to be updated in server and my server should raise an single event with these multiple changes.

but i see that in server side below write service is called one by one.

protected override StatusCode? Write(RequestContext context, NodeAttributeHandle nodeHandle, string indexRange,
DataValue value)
{
}

i could see an overload write service (below)which is being called once the above write service is completed or when i return null for above write service method.is it expected behavior ?

protected override void Write(RequestContext context, TransactionHandle transaction, IList<NodeAttributeOperationHandle> operationHandles, IList<WriteValue> settings)
{
base.Write(context, transaction, operationHandles, settings);
}

1.Is transaction rollback mechanism possible ?
2.Without returning null for the first write method is it not possible for second write method to handle all the changes ?
pls let me know if there is any alternate way.

User avatar
Support Team
Hero Member
Hero Member
Posts: 3064
Joined: 18 Mar 2011, 15:09

Re: Overriding Write Service methods

Post by Support Team »

Hello,

The method BaseNodeManager.Write(RequestContext context, NodeAttributeHandle nodeHandle, string indexRange, DataValue value) (http://documentation.unified-automation.com/uasdkdotnet/3.0.6/html/classUnifiedAutomation_1_1UaServer_1_1BaseNodeManager.html#a5370ecf5da9db3fbb7a9706c069e79c6) is called one by one. If this method returns null, nodeHandle, indexRange and value are added to lists that are passed to the other other Write method (http://documentation.unified-automation.com/uasdkdotnet/3.0.6/html/classUnifiedAutomation_1_1UaServer_1_1BaseNodeManager.html#a94bb5942cb9ebafe2667b1e1473d173c).

The default implementation of the first Write method returns null for nodes configured with NodeHandleType ExternalPolled or ExternalPushed.

If the overridden Write method does return a StatusCode, the application needs to store the information about this Write operation and evaluate this information in the second Write operation, if the information about the complete Write call needs to be reported to the application.

A transaction rollback is not implemented in the sdk. This is a task of the application if required.
Best regards
Unified Automation Support Team

Post Reply