fabriciocolombo / delphi-rest-client-api

A Delphi REST client API to consume REST services written in any programming language.
Apache License 2.0
380 stars 182 forks source link

Demo project does not compile in Delphi 7 #75

Closed LoganTennis closed 7 years ago

LoganTennis commented 8 years ago

Here are the errors below:

Aloso project would not even open till I removed the DSK file

Build [Error] uFrm_PersonList.pas(54): There is no overloaded version of 'Post' that can be called with these arguments [Error] uFrm_PersonList.pas(105): There is no overloaded version of 'Put' that can be called with these arguments [Error] uFrm_PersonList.pas(143): ';' expected but '<' found [Error] uFrm_PersonList.pas(144): Constant or type identifier expected [Error] uFrm_PersonList.pas(150): Incompatible types: 'String' and 'Class reference' [Error] uFrm_PersonList.pas(150): Expression expected but ')' found [Error] uFrm_PersonList.pas(152): Operator not applicable to this operand type [Error] uFrm_PersonList.pas(153): Expression expected but 'BEGIN' found [Error] uFrm_PersonList.pas(156): ')' expected but identifier 'id' found [Error] uFrm_PersonList.pas(162): EXCEPT or FINALLY expected [Error] uFrm_PersonList.pas(163): 'END' expected but 'FINALLY' found [Error] uFrm_PersonList.pas(166): '.' expected but ';' found [Fatal Error] DelphiRestDemo.dpr(8): Could not compile used unit 'uFrm_PersonList.pas'

I changed:

uFrm_PersonList.pas ( Line 148 from ) vResponse := Dm.RestClient.Resource(CONTEXT_PATH + 'persons') .Accept(RestUtils.MediaType_Json) .Get<TList>();

to:

vResource := Dm.RestClient.Resource(CONTEXT_PATH + 'persons').Accept(RestUtils.MediaType_Json); vResponse := TList(vResource.Get(TList,TPerson));

And The system crashed with Access Violation

ronaldhoek commented 8 years ago

This DEMO uses 'generics' so it will only compile with XE(2) and up!

PS: to make things working for XE(2) the reference to the datamodule is nog correct.

EDIT: made a pull request regarind this (and regarding the DSK files)

LoganTennis commented 8 years ago

Gave up on using this, because the demo did not work. The demo really should be tested under delphi 7 environments,

ronaldhoek commented 8 years ago

I think it would be best to create a second DEMO which does NOT use generics as this demo is valid when generics are available!

RobertoSchneiders commented 8 years ago

@LoganTennis sorry about that.

Probably no one is using this library on Delphi 7. That's why it isen't well tested.

We'll be grateful if you could help us with that.

ronaldhoek commented 8 years ago

We don;t work with older Delphi versions anymore - maybe @LoganTennis can try to make one based on the current code?

LoganTennis commented 8 years ago

I would love to update the demo project to be Delphi 7 compatible, unfortunately, I could not get it working. So I ditched the use of this component. In favour of "SimpleRestClient" by Jamie Ingilby.