Combine schema and data from 2 seperate server calls

(Paul Sjoerdsma) #1


Remobjects/DataAbstract V9

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)

Binary activeDataSet = broker.WebGetData(…);
Streamer.InitializeStreamer(activeDataSet, StreamerInitialization.ReadFromBeginning);
DataTable table = new DataTable(tableName);
Streamer.ReadDataTable(tableName, table, true, true);

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?


(antonk) #3


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);

Hope that helps

(Paul Sjoerdsma) #4

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 } });

Fits in


(antonk) #5

Then please describe more cleanly what exactly do you need to achieve:

  • Do you need a client-side code that will talk to a classic DA server to get a dataset+schema from it
  • Do you need a server-side code that should do something
  • Something else
  • Which platform you want to use for this code (Delphi or .NET)

(Paul Sjoerdsma) #6

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

Hopefully this is clear enough

(antonk) #7

This is the code that does exactly this: Combine schema and data from 2 seperate server calls

DataAbstract service’s .GetData method can return schema of queried tables and data itself in one response.

(Paul Sjoerdsma) #8

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)

(antonk) #9

Ah, so this is not a “classic DA server” in any way.

You can try to do the following:

First get the schema stream and put it into the table using

streamer1.InitializeStreamer(schema, StreamerInitialization.ReadFromBeginning);
streamer1.ReadDataTable(tableName, dataTable, true, false);

Then read the actual data and append it to the same table using call like

streamer2.InitializeStreamer(data, StreamerInitialization.ReadFromBeginning);
streamer2.ReadDataTable(tableName, dataTable, false, true);