You are not logged in.
Pages: 1
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
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
thanks, but can you post a example, for the simple table TSQLSampleRecord?
Thanks corchi
Offline
Pages: 1