Rest xml response?

Hi there, i have a client which handles only xml response. How to do this with RO? I added a TROXMLRpcMessage to the server Dispatchers und was expecting a magic RO thing. But the result is in json?

type
  TVersion = class(TROComplexType)
  private
    FVersion: ROUTF8String;
  published
    {$IFDEF RO_RTTI_Support} [ROSerializeAsUTF8String] {$ENDIF}
    property Version: ROUTF8String read FVersion write FVersion;
  end;

  [ROService(__ServiceName,__ServiceID)]
  TLprSbRestService = class(TRORemoteDataModule)
  private
  public
    [ROServiceMethod]
    [ROCustom('HttpApiPath','lpr')]
    [ROCustom('HttpApiMethod','Get')]
    function GetVersions: TROArray<TVersion>;
  end;

implementation

{%CLASSGROUP 'Vcl.Controls.TControl'}
{$R *.dfm}

{ TLprSbRestService }

function TLprSbRestService.GetVersions: TROArray<TVersion>;
var
  v: TVersion;
begin
  Result:= TROArray<TVersion>.Create;
  v:= Result.Add;
  v.Version:= '1.0.0.1';
  v:= Result.Add;
  v.Version:= '1.0.0.2';

end;

The result is in json

[{"Version":"1.0.0.1"},{"Version":"1.0.0.2"}]

Do i have to create the result somehow manually? If so how? It should be like:

<?xml version = "1.0" encoding = "utf-8"?>
<lpr:versions xmlns:lpr="http://3rdparty.com/lpr">
<version>v01.00</version>
<version>v01.01</version>
</lpr:versions>

Where can i overwrite the rest function result?

Hi,

HttpApi can generate only JSON response.
if you want to transform response to something else you can use the OnCustomResponseEvent event.

Check the Using OnCustomResponseEvent in a ROSDK Server snippet and related topics for more details.

Dear me. I was afraid of something like that.
Anyway:
As we have to do long time consuming stuff in some requests: is the event “ROServerCustomResponseEvent” available in multiple threads (one thread per request)? Or how can we parallel work with the requests?

Hi,

This event is available in multiple threads and designed for custom processing of unknown requests.
Note: this event is called from background thread that processes client request