Login  •  Register


BadTypeMismatch while writing value from Client  Topic is solved

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

BadTypeMismatch while writing value from Client

Postby Peter Eser » 22 Oct 2015, 13:22

Hello all,

UaExpert gives a "Write to node ... failed [ret = BadTypeMismatch] when I change the value in the Data Access View.
DataType in Attributes is UInt16, this seems ok, nevertheless Data Access View shows Datatype Int32.
HasTypeDefinition is BaseDataVariableType
AccessLevel is Readable,Writeable
If I put in text instead of a number I get an other error (Could not convert value...) -> good.
My (own written) server shows no error message.

BTW how can I catch such write changes fron the client in the server. PlainVariable.addChangeListener() seems to catch all changes, even those with setValue().

Thanks for any help.
Regards, Peter
Peter Eser
Full Member
Full Member
 
Posts: 8
Joined: 22 Oct 2015, 13:00

Re: BadTypeMismatch while writing value from Client

Postby Support Team » 22 Oct 2015, 18:51

Hi Peter,

It looks like the server provides a different data type in the Value attribute (Int32) than indicated in the DataType attribute (UInt16).
UaExpert tries to write the data type back that he received before from the server. This fails since the server has to check the data type at write and we assume that the server rejects the written value (Int32) since the data type attribute is set to UInt16.

Please check what is the right data type (Int32 or UInt16) and set Value and DataType attribute consistent in your server.

Best Regards,
Unified Automation Support Team
User avatar
Support Team
Hero Member
Hero Member
 
Posts: 2420
Joined: 18 Mar 2011, 15:09

Re: BadTypeMismatch while writing value from Client

Postby Peter Eser » 23 Oct 2015, 09:52

Hello Support Team,

many thanks for answering. You're right, the Object type for setValue() in CacheVariable must 100% map to the DataType set.
So e.g. cannot set a Java Integer for an UInt16, have to remap to org.opcfoundation.ua.builtintypes.UnsignedShort.

Any idea to listen to such write changes from the client in the server?

Thanks and Regards, Peter
Peter Eser
Full Member
Full Member
 
Posts: 8
Joined: 22 Oct 2015, 13:00

Re: BadTypeMismatch while writing value from Client  Topic is solved

Postby Support Team » 26 Oct 2015, 08:38

Hello,

The IoManagerListener is used to listen to change (i.e. write) requests from clients. The Server Tutorial shows how to use it.

Best regards
Suppport Team
User avatar
Support Team
Hero Member
Hero Member
 
Posts: 2420
Joined: 18 Mar 2011, 15:09


Return to JAVA based OPC UA SDK

Who is online

Users browsing this forum: No registered users and 0 guests

cron