HttpApiPath - Argument out of range

Hi,

I have a service with this declaration:
[ROServiceMethod]
[ROCustom(‘HttpApiPath’,‘customer/{idCliente}/filiale/{idFiliale}/modify’)]
[ROCustom(‘HttpApiMethod’,‘POST’)]
function modifyStore(idCliente:Integer;idFiliale: Integer): MessageResult;

when i run the server i have this error: First chance exception at $753D08B2. Exception class EArgumentOutOfRangeException with message ‘Argument out of range’.

if i remove {idFiliale} from HttpApiPath and idFiliale: Integer from function declaration it’s run.
I don’t understand why i can’t have more than one {} on HttpApiPath declaration.

I can’t reproduce this case. I’ve tried

type
  MessageResult = string;

  [ROService(__ServiceName)]
  TNewService = class(TRORemoteDataModule)
  private
  public
    [ROServiceMethod]
    [ROCustom('HttpApiPath','customer/{idCliente}/filiale/{idFiliale}/modify')]
    [ROCustom('HttpApiMethod','POST')]
    function modifyStore(idCliente:Integer;idFiliale: Integer): MessageResult;
  end;
...
function TNewService.modifyStore(idCliente, idFiliale: Integer): MessageResult;
begin
  result := Format('client = %d, branch = %d',[idCliente, idFiliale]);
end;

request:

>curl -X POST "http://localhost:8099/api/customer/5/filiale/10/modify" -H  "accept: application/json"

response:

"client = 5, branch = 10"

can you specify what version of ROD you are using, pls?

Hi EvgenyK,

Thanks for your answer.

I’m using:
Delphi 10.2
Rem Object Everwood 4.7.83.749
Rem Object SDK 9.3.105.1345

This is my code:

const
CONSOLE_SERVICE_NAME =‘CustomerRestService’;
type

[ROService(CONSOLE_SERVICE_NAME)]
TCustomerRestService = class(TDataAbstractService)
DABin2DataStreamer1: TDABin2DataStreamer;
dbSchema: TDASchema;
private
public
[ROServiceMethod]
[ROCustom(‘HttpApiPath’,‘customer/{idCliente}/filiale/{idFiliale}/modify’)]
[ROCustom(‘HttpApiMethod’,‘POST’)]
function modifyStore(idCliente:Integer;idFiliale: Integer): MessageResult;

I’m using DataAbstract service, that’s the only difference from you example.

Thanks
Enrico

DA based service also works on my side.
Can you retest this issue with the latest beta, pls?

ok thanks,
I’ll retes, but I have to wait new VMware machine with the latest SDK, from my team.

Enrico

Hi
I tried with Rem Object SDK 9.4.107.1363 (I suppose the last version) your base service and I have same error.

Thanks
Enrico

can you reproduce original issue with my testcase? testcase.zip (112.4 KB)

Hi
I confirm your testcase.zip run perfectly.

I think the problem is that my project is a dataabstract project (VCL Application->New Custom Data Abstract Server) in witch i added a TROHttpApiDispatcher.

I define my service like:

const
CONSOLE_SERVICE_NAME =‘CustomerRestService’;
type

[ROService(CONSOLE_SERVICE_NAME)]
TCustomerRestService = class(TDataAbstractService)
DABin2DataStreamer1: TDABin2DataStreamer;
dbSchema: TDASchema;
private
public
[ROServiceMethod]
[ROCustom(‘HttpApiPath’,‘customer/{idCliente}/filiale/{idFiliale}/modify’)]
[ROCustom(‘HttpApiMethod’,‘POST’)]
function modifyStore(idCliente:Integer;idFiliale: Integer): MessageResult;
.
.
.
initialization
RegisterCodeFirstService(TCustomerRestService );

Is it possible have a DataAbstract project with ROService? Because of if I use your NewService_Impl.pas in your Remoting SDK project it runs well, but if I use your NewService_Impl.pas in my Dataabstract project it fails during running with this error message : ‘Argument out of range’.

pls test my testcase - I’ve simple replaced ancestor for service and it works w/o any problems:
da_testcase.zip (112.8 KB)

curl -X POST "http://localhost:8099/api/customer/10/filiale/13/modify" -H  "accept: application/json"
"client = 10, branch = 13"

Hi,

I tried your project and it runs perfectly.
As I told you before the problem is on my project that is different from your because I have created a DataAbstract server: fServerForm (img1) and a fServerDataModule with ROHttpiApiDispatcher (img2):
FServerFormfServerDataModule1

FserverForm:

unit fServerForm;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,
uDAPoweredByDataAbstractButton, uROPoweredByRemObjectsButton;
type
TServerForm = class(TForm)
DAPoweredByDataAbstractButton1: TDAPoweredByDataAbstractButton;
private
{ Private declarations }
public
{ Public declarations }
end;
var
ServerForm: TServerForm;
implementation
{$R *.dfm}
end.

fServerDataModule:

unit fServerDataModule;
{$I DataAbstract.inc}
interface
uses
{vcl:}SysUtils, Classes,
{RemObjects:} uROClient, uROClientIntf, uROServer, uROSessions, uROMessage, uROComponent,
uROBaseConnection, uROBinMessage,uROIpHttpServer,
{Data Abstract:} uDAEngine, uDADriverManager, uDAStreamableComponent, uDAConnectionManager, uDADataDictionary,
uDAFireDACDriver, uROServerIntf, uROCustomRODLReader, System.TypInfo,
uDAServerInterfaces, uROHTTPDispatch, uROHttpApiDispatcher,
uROCustomHTTPServer, uROBaseHTTPServer;
type
TServerDataModule = class(TDataModule)
ConnectionManager: TDAConnectionManager;
DriverManager: TDADriverManager;
DataDictionary: TDADataDictionary;
SessionManager: TROInMemorySessionManager;
Server: TROIpHTTPServer;
Message: TROBinMessage;
ROHttpApiDispatcher1: TROHttpApiDispatcher;
procedure ModuleCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
ServerDataModule: TServerDataModule;
implementation
{$IFDEF DELPHIXE2UP}
{%CLASSGROUP ‘System.Classes.TPersistent’}
{$ENDIF}
{$R *.dfm}
procedure TServerDataModule.ModuleCreate(Sender: TObject);
begin
Server.Active := true;
end;
end.

And after there is the service class in your example…
When I launch the run I have the ‘out of range’ error… If i remove one of two {} params, for example {idFiliale}, it runs without errors.

Thanks
Enrico

Looks like, I need your project for reproducing this issue.

can you create a simple testcase that reproduces this issue, pls?
you can attach it here or send directly to support@

I have the same problem. As soon as the main RODL has a reference to another service and you define more than one URL path parameter, the aforementioned exception will appear.
Here is a simple testcase. Remove the reference and everything will work fine.
TestCase.zip (161.4 KB)

Thanks, logged as bugs://80484

typo.
pls update uROHttpApiUtils.pas, line 177 as

if TROHttpApiParameter(lparams[l]).Name = s then
1 Like

bugs://80484 got closed with status fixed.