Capture IROMessage content


Is there any general way to capture and read the content of a communication message referenced by the IROMessage interface, without using a specific instance of the implementing object? I am specifically interested in the possibility of capturing the content of binary messages. Something like this:

> function TMyInvoker.HandleMessage(const aFactory: IROClassFactory;
>       const aMessage: IROMessage; const aTransport: IROTransport;
>       out oResponseOptions: TROResponseOptions): boolean;
> begin
    // get message content as XML or JSON..
>   var LContent:= aMessage.GetAsString;
> end;

Thanks, regards from Prague,


TROBinMessage supports IROStreamAccess so you can use it :

  IROStreamAccess = interface
    function GetStream: TStream;
    property Stream: TStream read GetStream;

note: don’t forget to restore stream position after saving stream content.

Thank you for your reply, I probably wasn’t very clear. I know I can read the message content as a generic TStream, using the IROStreamAccess interface. My point is more whether it is possible to deserialize the content and convert it into a readable string, e.g. XML or JSON, in a general way, without knowing the structure and content of the message. I need this in order to log traffic on the server.

Maybe there is a procedure for general conversion of messages from one format to another, e.g. from binary TROBinMessage to TROJSONMessage…?

Thanks, regards from Prague


You can’t do general conversion w/o knowing structure.

We don’t write type of data so raw data - #01 00 00 00 can be:

  • Enumerated
  • Boolean
  • Integer
  • String
  • Binary


Thank you for the answer… I thought so.

Regards from Prague