We have a Delphi application server that has 2 calls
1- GetSchema (only returns the schema --> DataStreamer.WriteDataset(Screen.DatasetSchema, dataset, [woSchema]))
2- GetData (only returns the data --> dataStreamer.WriteDataset(result, dataset, [woRows], 100))
Standard these calls are being used with a TDARemoteDataAdapter from a Delphi client
From a web service we currently use teh following logic to get a datatable (using a completely different method on the appserver)
We now need to use the GetData call (that only returns the data) from the webservice and we can’t change the appserver at this moment.
How can I combine the GetData en GetSchema calls and obtain a valid DataTable from the C# webservice?
If I understand you correct you need to call the standard DataAbstract data service not using a DataAdapter instance and you need to retrieve table data and schema from it. Here is the code that can help you with it:
var dataTable = new DataTable();
// Create service proxy
var svc = new DataAbstractService_Proxy(new BinMessage(), new IpHttpClientChannel { TargetUrl = "http://localhost:8099/bin"}, "DataService");
// Get serialized data
var tableName = "Customers";
// Get data (includes both table AND schema
var data = svc.GetData(new[] { tableName }, new TableRequestInfo[] { new TableRequestInfoV5 { IncludeSchema = true } });
// Deserialize data
var streamer = new Bin2DataStreamer();
streamer.InitializeStreamer(data, StreamerInitialization.ReadFromBeginning);
streamer.ReadDataTable(tableName, dataTable, true, true);
Hmm, I don’t think this will work, but please correct me if I am wrong.
We are using what, I think you call a classic server".
So on the server side
GetData results in dataStreamer.WriteDataset(result, dataset, [woRows], 100))
GetSchema results in DataStreamer.WriteDataset(Screen.DatasetSchema, dataset, [woSchema]))
Internally, on the server, we create the sql and cache this
Both calls take a different parameters
GetSchema(string, int)
GetData(string, int, , , int, int)
So not sure how
// Get data (includes both table AND schema
var data = svc.GetData(new[] { tableName }, new TableRequestInfo[] { new TableRequestInfoV5 {IncludeSchema = true } });
I need client side code (in C#) that will talk to a classis DA server to get a dataset+schema
The server (written in Delphi) has two methods available:
GetData - to get the data without the schema
GetSchema - to get the schema without the data
My bad, I think I haven’t been clear enough.
It’s not a DataAbstract service I think it 's a RemObject service
public partial class PSPUserDataBroker_Proxy : RemObjects.SDK.Proxy, IPSPUserDataBroker
Which has these two methods to get the data (without the schema) and the schema (without) the data
public virtual RemObjects.SDK.Types.Binary GetData(string UsersessionId, int ScreenSeq, TPSPSrvSearchDef SearchDefinition, TPSPSrvSearchDef ChildSearchDef, TPSPSrvString[] KeyNames, TPSPSrvVariant[] KeyValues, int StartRow);
public virtual RemObjects.SDK.Types.Binary GetSchema(string UsersessionId, int ScreenSeq)