Read TROMessage information

Hello

I need to know if there is a way to read the information of a TROMessage to get the name of the parameters, their values and the type of data, all this dynamically.

I have performed tests based on the Intf and Invk files to get the value as follows:

pMessage.Read (‘Parameter name’, ‘Data type’, ‘Output value’, []);

However, this form requires having the name of the parameter and the data type.

I’m using:
RAD Studio XE7
RemObjects 8.0.81.1131

Thanks in advance

you can’t read unknown stream.
for example, in TROBinMessage data was written compacted without Name and as plain data:

procedure TROStreamSerializer.WriteInt64(const aName: string; const Ref; ArrayElementId : integer = -1);
begin
  fStream.Write(Ref, SizeOf(Int64));
end;

procedure TROStreamSerializer.WriteUnicodeString(const aName: string; const Ref;
  ArrayElementId: integer);
var sze,sze2 : integer;
begin
  sze := Length(UnicodeString(Ref));
  sze2 :=sze;
  fStream.Write(sze2, SizeOf(sze2));
  if (sze>0) then fStream.Write(UnicodeString(Ref)[_StrLow], sze*2);
end;

etc. i.e. without knowing format, you can’t read data correctly.

What exactly you want to reach?

You can declare some struct, create method like

function Echo(Value: MyStruct): MyStruct;

and pass into this method MyStruct’s descendants. it will work and it will be read correctly by other side.

Hello,

I needed to read the values of the parameters of the remote functions, ie the values that reach the remote function.

I used the RTTI library, and a small algorithm to get those values using the IROMessage I get in the OnActivate event of my IMPL.

Thanks in advance

What message type (Bin, Json, SOAP, etc) you are using?
for non-Bin messages, you can read parameters because they are passed as text