Hi,
I am able to pass an object of a class to a xdata service method from Web core app by using xdataweb client by calling RawInvoke.
But i am getting error when I pass a TList object of the class to xdata service method.
So can we pass a TList object to a xdata service method from Web core app by using xdataweb client by calling RawInvoke.
Let me explain in detail
I have a model unit having following classes
enquiry model unit
TCRMEnquiry = class(TObject)
enquiryid: integer;
custid: integer;
notes: string;
end;
TCRMEnquiryDetail = class(TObject)
enqDetId: Integer;
enquiryId: Integer;
qty: Integer;
price: Double;
end;
Service unit having following methods
enquiry service unit
type
[ServiceContract]
[Route('enquiry')]
IenquiryService = interface(IInvokable)
['{735FGH3D-363F-4456-AA08-A564526EFAF2}']
[HttpPost, Route('add')]
procedure AddEnquiry(aRepId: integer; aEnquiryObj: TCRMEnquiry; aEnquiryDtlObjList: TList<TCRMEnquiryDetail>);
I do get error when I pass data to above xdata service method endpoint from webcore app by using xdata webclient as follow
procedure TfrmEnquiryPage.AddEnquiryData;
var
aEnquiryObj: TCRMEnquiry;
aEnquiryDtlObj: TCRMEnquiryDetail;
aEnquiryDtlObjList: TList<TCRMEnquiryDetail>;
repId: integer;
begin
repId := 5;
aEnquiryObj := TCRMEnquiry.Create;
with aEnquiryObj do
begin
enquiryid := webdsEnquiryDataEnquiryID.Asinteger;
custid := webdsEnquiryDatacustrecid.Asinteger;
notes := webdsEnquiryDatanotes.AsString;
end;
aEnquiryDtlObjList := TList<TCRMEnquiryDetail>.Create;
while not webdsEnquiryDtlList.Eof do
begin
aEnquiryDtlObj := TCRMEnquiryDetail.Create;
with aEnquiryDtlObj do
begin
enqDetId := webdsEnquiryDtlListenqDetId.AsInteger;
enquiryId := webdsEnquiryDtlListenquiryId.AsInteger;
qty := webdsEnquiryDtlListqty.AsInteger;
targetPrice := webdsEnquiryDtlListtargetPrice.AsInteger;
end;
aEnquiryDtlObjList.Add(aEnquiryDtlObj);
webdsEnquiryDtlList.Next;
end;
Console.Log(aEnquiryObj);
Console.Log(aEnquiryDtlObjList);
xDataWebClient1.RawInvoke('IenquiryService.AddEnquiry',
[repId, aEnquiryObj, aEnquiryDtlObjList], @EnquiryUpdate_Success)
end;
I get following error..
Expected Begin Array but was Begin Object at path $.aEnquiryDtlObjList