Stream read error serializing a record

Hi,

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?

Thanks,

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

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)
  private
    fFirstName: AnsiString;
    fLastName: AnsiString;
    fAge: Integer;
    fSex: TSex;
  published
    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;
  end;
  • arrays are defined as TROArray<T> descendant:
TPersonArray = class(TROArray<TPerson>);
  • exceptions:
  ETestException = class(EROServerException)
  private
    fErrorCode: Integer;
    fAdditionalInfo: AnsiString;
  public
    constructor Create(anExceptionMessage: String; aErrorCode: Integer; aAdditionalInfo: AnsiString);
  published
    property ErrorCode: Integer read fErrorCode write fErrorCode;
    property AdditionalInfo: AnsiString read fAdditionalInfo write fAdditionalInfo;
  end;
1 Like