#1 2020-11-19 14:03:06

radexpol
Member
From: Poland, Krk
Registered: 2019-11-29
Posts: 116

SOA - Access Violation

I'm getting AV in line

  aClassType := GetClassParent(aClassType);   -> access violation
       
in: function JSONObjectFromClass(aClassType: TClass; out aParser: PJSONCustomParser): TJSONObject;

my code:

  IQueues = interface(IInvokable)
    ['{9857C187-68A2-4F22-823C-75B75F28B45A}']
    function GetQueues(out response: TQueuesCollection): TResponse;
    function WorkingHours(const MediaType: RawUTF8; out response: TQueuesWorkingHours): TResponse;
  end;

  TQueuesCollection = class(TInterfacedCollection)
  protected
    class function GetClass: TCollectionItemClass; override;
  end;


Usage:


  connector.ServiceDefine(IQueues, sicSingle).ResultAsJSONObjectWithoutResult := True;
  var obj: IQueues;
  var list: TQueuesCollection;
  connector.Services.Resolve(IQueues, obj);
  obj.GetQueues(list);  -> access violation


Web request /queues.getqueues works fine.

Offline

#2 2020-11-19 16:21:07

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: SOA - Access Violation

There is not enough information here to understand what you did wrong.

Please don't post code in the thread - as stated by the forum rules.

Put some reproducible example in a linked gist page for instance.

Did you create the TQueuesCollection instance in the client code, before calling the method?

Offline

#3 2020-11-19 17:37:04

radexpol
Member
From: Poland, Krk
Registered: 2019-11-29
Posts: 116

Re: SOA - Access Violation

Thats right: https://www.dropbox.com/s/qyv1yxe1l00qi … e.txt?dl=0

Are you sure that storing source code samples in external services such as dropbox is a good solution? Those samples won't be available in the future if I remove dropbox file, so my solution won't be available for anyone. Why we can't put the good solutions in the forum, you don't provide such smart helpful code solutions in documentation so that forum is one of the best source sharing service IMHO.

Offline

#4 2020-11-19 17:57:20

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: SOA - Access Violation

Use Gist for posting code. It will stay available.

What you posted is not a reproducible example.
https://stackoverflow.com/help/minimal- … le-example

Offline

Board footer

Powered by FluxBB