Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when creating TRESTClient: "No peer with the interface with guid [{}] has been registered"

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?

like image 576
Seeko Avatar asked Oct 16 '25 16:10

Seeko


2 Answers

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

like image 172
dvpublic Avatar answered Oct 18 '25 13:10

dvpublic


Add IPPeerClient to the interface uses and problem solved

like image 28
GBg Avatar answered Oct 18 '25 12:10

GBg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!