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

Hello, I have try to test you REST api, but have a error when complile it. #7

Closed wqmeng closed 11 years ago

wqmeng commented 11 years ago

class function TJsonUtilGenerics.Marshal(entity: TObject): string; begin Result := entity.ToJson().AsJSon(); end;

[DCC Error] RestJsonGenerics.pas(26): E2003 Undeclared identifier: 'ToJson'

Is the function ToJson still not implement yet? Or I have miss something?

Thanks

wqmeng commented 11 years ago

Also do you have some demo code?

Thank you.

fabriciocolombo commented 11 years ago

Hi, what your delphi version?

wqmeng commented 11 years ago

Hello, Delphi XE .

Thanks

fabriciocolombo commented 11 years ago

I reviewed the packages for D7, XE and XE2 and could not reproduce the problem. The method toJSON is declared in class helper TSuperObjectHelper inside the unit SuperObject. Maybe you have in your library path an older version of SuperObject that does not contain this helper, anyway, you must use the library SuperObject that is inside the folder lib\superobject because it contains modifications.

About the demo, I'll work on that.

prakashgoswami commented 11 years ago

i am having trouble compiling the demo code in Delphi7, (ufrm_personlist.pas line : 105) DM.RestClient.Resource(CONTEXT_PATH + 'person') .Accept(RestUtils.MediaType_Json) .ContentType(RestUtils.MediaType_Json) .Put (vPerson) .Free; how to replace for delphi7 compatibility. thanks in advance.

fabriciocolombo commented 11 years ago

Sorry for the delay in answering your question.

The method you are using makes use of Generics, and is only available from Delphi 2010 and newer.

I intend to implement serialization for Delphi 7 soon, but for now, you need to use the methods Post (Content: TStream) or Post (content: String), and format the content properly.

Follow the project on github that will soon have news about serialization for Delphi 7.

2013/7/14 prakashgoswami notifications@github.com

i am having trouble compiling the demo code in Delphi7, (ufrm_personlist.pas line : 105) DM.RestClient.Resource(CONTEXT_PATH + 'person') .Accept(RestUtils.MediaType_Json) .ContentType(RestUtils.MediaType_Json) .Put (vPerson) .Free; how to replace for delphi7 compatibility. thanks in advance.

— Reply to this email directly or view it on GitHubhttps://github.com/fabriciocolombo/delphi-rest-client-api/issues/7#issuecomment-20941583 .

Atenciosamente

Fabricio Colombo

Desenvolvedor Delphi e Java Maringá - PR Blog: http://fabriciodev.blogspot.com [image: Siga-me no Facebook] http://facebook.com/fabriciodev Siga-me no Facebook http://facebook.com/fabriciodev [image: Siga-me no Twitter]http://twitter.com/fabriciodev Siga-me no Twitter http://twitter.com/fabriciodev http://fabriciodev.blogspot.com/ http://fabriciodev.blogspot.com/

leacarbonera commented 6 years ago

Olá, Fabricio tudo bem. Estou tentando instalar a biblioteca RestClient no meu Delphi XE2, mas ao compilar me apresenta o seguinte erro no arquivo Restclient.pas, na função :

function TResource.Post(Entity: TObject): TObject; begin Result := Post(Entity, Entity.ClassType); end;

"[DCC Error] RestClient.pas(1001): E2250 There is no overloaded version of 'Post' that can be called with these arguments"

O que pode ser será?

Abraço

berniQ23 commented 6 years ago

I can confirm the comment from Abraco from November 2017. A fresh checkout from today gives on compiling DelphiXE4_RestApi.bpl:

[dcc32 Fehler] RestClient.pas(1001): E2250 Es gibt keine überladene Version von 'Post', die man mit diesen Argumenten aufrufen kann => function TResource.Post(Entity: TObject): TObject; begin Result := Post(Entity, Entity.ClassType); end;

[dcc32 Fehler] RestClient.pas(1028): E2250 Es gibt keine überladene Version von 'Put', die man mit diesen Argumenten aufrufen kann => function TResource.Put(Entity: TObject): TObject; begin Result := Put(Entity, Entity.ClassType); end;

[dcc32 Fehler] RestClient.pas(1065): E2250 Es gibt keine überladene Version von 'Patch', die man mit diesen Argumenten aufrufen kann => function TResource.Patch(Entity: TObject): TObject; begin Result := Patch(Entity, Entity.ClassType); end;

How to fix it? Regards, Bernd