I've created my class to work with REST. I have a problem with TRESTClient component in runtime.
TFrwWebServiceREST = class(TInterfacedObject, IRESTWebServiceProxy)
private
FClientRest: TRESTClient;
FRequestRest: TRESTRequest;
FResponseRest: TRESTResponse;
public
constructor Create (AUrl: string); virtual;
end;
...
constructor TFrwWebServiceREST.Create(AUrl: string);
begin
FClientRest := TRESTClient.Create (AUrl); //the error occurs here
FClientRest.AcceptEncoding := 'UTF-8';
FResponseRest := TRESTResponse.Create (nil);
FResponseRest.ContentEncoding := 'UTF-8';
FRequestRest := TRESTRequest.Create (nil);
FRequestRest.AcceptEncoding := 'UTF-8';
FRequestRest.Response := FResponseRest;
FRequestRest.Client := FClientRest;
end;
The error does not always occur ... The process works perfectly, and then after a while, this error starts to occur.
First chance exception at $7656C54F. Exception class EIPAbstractError with message 'No peer with the interface with guid {B8BD5BD8-C39D-4DF1-BB14-625FC86029DB} has been registered'.
The exception is raised when creating the RESTClient. What can it be?
It's necessary to include IPPeerClient to the interface "uses" clause in your client code and to include IPPeerServer to the interface "uses" clause in your server code, please see http://blogs.embarcadero.com/pawelglowacki/2013/01/10/39958
Add IPPeerClient to the interface uses and problem solved
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With