Stream read error serializing a record

(davidizadar) #1


I created a RemObjects Service using “code first” and simple types. It worked flawlessly.
Later, I needed to receive a record and I couldn’t find how to do it with the code-first approach.
After switching to Service Builder, I defined the struct and used it as an output parameter. Generated everything, interface, invoker, and implementation. Inherited from the implementation to reproduce the former behavior, and tested it. Every call to the service triggered an exception “Stream read error” (serializing the structure).
Obviously, I’m doing something wrong.
Can anyone help me?


Sorry, my bad. My new client was trying to talk to the old server. It works perfectly! I love RemObjects!

(EvgenyK) #2

You can generate RODL project, define all types and then convert it to Code-First project with wizard. it can be more easy way

  • structs are defines in Code-First as TROComplexType descendants:
  TPerson = class(TROComplexType)
    fFirstName: AnsiString;
    fLastName: AnsiString;
    fAge: Integer;
    fSex: TSex;
    property FirstName: AnsiString read fFirstName write fFirstName;
    property LastName: AnsiString read fLastName write fLastName;
    property Age: Integer read fAge write fAge;
    property Sex: TSex read fSex write fSex;
  • arrays are defined as TROArray<T> descendant:
TPersonArray = class(TROArray<TPerson>);
  • exceptions:
  ETestException = class(EROServerException)
    fErrorCode: Integer;
    fAdditionalInfo: AnsiString;
    constructor Create(anExceptionMessage: String; aErrorCode: Integer; aAdditionalInfo: AnsiString);
    property ErrorCode: Integer read fErrorCode write fErrorCode;
    property AdditionalInfo: AnsiString read fAdditionalInfo write fAdditionalInfo;