Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Problem Loading Graphics Column
Fri, Jun 24 2016 2:33 PMPermanent Link

Sidney

I created a RealThinClient server and installed the datasetclient demo.  I am running from the demo from firefox.  The rows request works correctly for both the EWB external server and the RTC server:
EWB Server: GET http://localhost:81/customdatasets?method=rows&dataset=Biolife HTTP/1.1
RTC Server:  GET http://localhost:91/customdatasets?method=rows&dataset=Biolife HTTP/1.1

The load requests are identical except the port for EWB is 81 and the port for RTC is 91:
GET http://localhost:81/customdatasets?dataset=Biolife&method=load&column=Graphic&row=90020 HTTP/1.1
Host: localhost:81
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://localhost:81/datasetclient2.html
Connection: keep-alive

The responses are different:

EWB server response - always provides correct image:
HTTP/1.1 200
Date: Fri, 24 Jun 2016 17:59:42 GMT
From:
Server: Elevate Web Builder 2 Web Server
Connection: Keep-Alive
Cache-Control: no-cache
Content-Length: 35644
... Multiple lines of binary data ... - Fiddler recognizes and displayed the image.

RTC server response - always the same length and content regardless of the row key:
HTTP/1.1 200 OK
CONTENT-LENGTH: 38886
... Single line of binary data ... - Fiddler says "Not an image".

The values sent to GetColumn are ('Graphic','90020').  These values are correct.

The TEWBDataAdpater has the following settings:
DataSet=Biolife
KeyFields=Species No
Name=BiolifeAdapter
NumKeyFields=1

Question 1:  What do I need to do to properly return the graphic?

Question 2:  How do I add additional headers to my response?

My code is below:

procedure TfmMain.CustomDatasetsProvDataReceived(Sender: TRtcConnection);
var
 RequestMethod,RequestDataset,ColumnId,RowId,ResponseValue: String;
begin
 with TRtcDataServer(Sender) do
 if Request.Complete then
   begin
     RequestMethod := Request.Query.Value['method'];
     RequestDataset := Request.Query.Value['dataset'];
     ColumnId := Request.Query.Value['column'];
     if SameText(RequestDataset,'Biolife')
     and SameText(RequestMethod,'rows') then
       begin
         ResponseValue := dmBiolife.GetRows; // <<<<< RETURNS CORRECT DATA
         Write(ResponseValue);
       end
     else if SameText(RequestDataset,'Biolife')
     and SameText(RequestMethod,'load')
     and SameText(ColumnId,'graphic') then
       begin
         RowId := Request.Query.Value['row'];
         MessageLabel.Text := 'Debug='+RequestMethod+' DS='+RequestDataset+' Col='+ColumnId+' Row='+RowId;
         ResponseValue := dmBiolife.GetColumn(ColumnId,RowId); // <<<<< RETURNS INCORRECT DATA
         Write(ResponseValue);
       end;
   end;
end;

function TdmBiolife.GetRows: String;
begin
 BiolifeConnection.Connected := True;
 Biolife.Active := True;
 Result := BiolifeAdapter.BuildRows('customdatasets');
 Biolife.Active := False;
 BiolifeConnection.Connected := False;
end;

function TdmBiolife.GetColumn(ColumnId,RowId: String): String;
begin
 BiolifeConnection.Connected := True;
 Biolife.Active := True;
 Result := BiolifeAdapter.BuildLoad(ColumnId,RowId); // <<<< PROBLEM IS LIKELY HERE
 Biolife.Active := False;
 BiolifeConnection.Connected := False;
end;
Tue, Jun 28 2016 9:21 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Sidney,

<< function TdmBiolife.GetColumn(ColumnId,RowId: String): String;
begin
 BiolifeConnection.Connected := True;
 Biolife.Active := True;
 Result := BiolifeAdapter.BuildLoad(ColumnId,RowId); // <<<< PROBLEM IS LIKELY HERE >>

BuildLoad returns an AnsiString, not a String (if using Delphi 2009 or higher).  That is most likely the issue, especially if you're not specifically converting the string to UTF-8 or something similar before sending it as a response.

Tim Young
Elevate Software
www.elevatesoft.com
Image