#1 2015-10-21 09:50:19

corchi72
Member
Registered: 2010-12-10
Posts: 232

How to Read TSQLTable in XML format?

how do I set up a simple server to read all the tables in XML format, I have to read XML and JSON because the program that consumes not read JSON!!!

I read the documentation and found a parameter to be set "ResultAsXMLObject", but I do not understand how can I get there to set it to TRUE,
see this document:
http://blog.synopse.info/post/2014/08/0 … eturns-XML



procedure TForm1.FormCreate(Sender: TObject);
begin
  Model := TSQLModel.Create([TSQLSampleRecord]);
  DB := TSQLRestServerDB.Create(Model,ChangeFileExt(paramstr(0),'.db3'),false);
  // customize RESTful URI parameters as expected by our ExtJS client 
  DB.URIPagingParameters.StartIndex := 'START=';
  DB.URIPagingParameters.Results := 'LIMIT=';
  //DB.URIPagingParameters.SendTotalRowsCountFmt := ',"total":%';
  // initialize and launch the server
  DB.CreateMissingTables;
  Server := TSQLHttpServer.Create('8080',[DB],'+',useHttpApiRegisteringURI);
  Server.AccessControlAllowOrigin := '*'; // allow cross-site AJAX queries


//  DB.Services.ResultAsJSONObject ;?????????

end;

Thanks corchi

Offline

#2 2015-10-21 10:22:07

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

Re: How to Read TSQLTable in XML format?

ResultAsXMLObjectIfAcceptOnlyXML is only for a given service, in the SOA context.

I guess you want to use the ORM aspect of the framework, not SOA.

In this case, there is no direct way of returning XML.
What you can do is to define your own REST services, using method-based services, then compute the TSQLTableJson result, and use e.g. TSQLTable.GetMSRowSetValues method.

Offline

#3 2015-10-21 10:27:17

corchi72
Member
Registered: 2010-12-10
Posts: 232

Re: How to Read TSQLTable in XML format?

thanks, but can you post a example, for the simple table TSQLSampleRecord?

Thanks corchi

Offline

Board footer

Powered by FluxBB