Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.

Public Report
Report From: EDN/Member services    [ Add a report in this area ]  
Report #:  137684   Status: Open
REST.Client compatability with iOS on Delphi 10.1
Project:  EDN Build #:  24.0.22858.6822
Version:    2 Submitted By:   Jason West
Report Type:  Issue Date Reported:  7/9/2016 3:12:06 PM
Severity:    Serious / Highly visible problem Last Updated: 9/19/2016 11:28:04 AM
Platform:    All platforms Internal Tracking #:   80077
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: 11
Description
When attempting to execute a call to a basic url endpoint (with querystrings) that returns plain text response using the REST framework on Delphi 10.1 Berlin, and only targeting the iOS platform (iPhoneOS 9.3) - note that Android & Windows are fine - the call fails with an exception : 'Data Error' 'EZDecompressionError'.  The same code operated perfectly fine using Delphi 10.0 Seattle.  An example call is :

procedure TfrmSettings.btnRestCall(Sender: TObject);
var
  restClient : TRESTClient;
  restRequest : TRESTRequest;
begin
  try
    if (editUserAccount.Text = '') then
    begin
      ShowMessage('Please supply a valid user account so we can send you the provisioning details.');
      editUserAccount.SetFocus;
    end
    else
    begin
      if (CheckInternet('google.com')) then
      begin
        restClient := TRESTClient.Create('https://restendpoint.com/restendpoint/');
        restRequest := TRESTRequest.Create(nil);
        restRequest.Client := restClient;
        restRequest.Method := rmGET;
        restRequest.Resource := 'functions.aspx?fn=RestCall'
                                + '&restParam1=' + URIEncode(editUserAccount.Text);
        restRequest.Execute;
        ShowMessage(restRequest.Response.Content);
      end
      else
      begin
        ShowMessage('Unfortunately your device is not currently able to access the internet to request the provisioning key.  Please check the network settings of your device and try again when you are connected.');
      end;
    end;
  finally
    restClient.Free;
    restRequest.Free;
  end;
end;
Steps to Reproduce:
As per full description, simply produce an multi device application that can target iOS (using iPhoneOS 9.3) & drop a button on the form.  Obviously you will need to have a working REST URL endpoint that can accept query string parameters and produce a basic plain text response.  Then drop a button on the form and wire it up to a method call in a similar way as per below:

procedure TfrmSettings.btnRestCall(Sender: TObject);
var
  restClient : TRESTClient;
  restRequest : TRESTRequest;
begin
  try
    if (editUserAccount.Text = '') then
    begin
      ShowMessage('Please supply a valid user account so we can send you the provisioning details.');
      editUserAccount.SetFocus;
    end
    else
    begin
      if (CheckInternet('google.com')) then
      begin
        restClient := TRESTClient.Create('https://restendpoint.com/restendpoint/');
        restRequest := TRESTRequest.Create(nil);
        restRequest.Client := restClient;
        restRequest.Method := rmGET;
        restRequest.Resource := 'functions.aspx?fn=RestCall'
                                + '&restParam1=' + URIEncode(editUserAccount.Text);
        restRequest.Execute;
        ShowMessage(restRequest.Response.Content);
      end
      else
      begin
        ShowMessage('Unfortunately your device is not currently able to access the internet to request the provisioning key.  Please check the network settings of your device and try again when you are connected.');
      end;
    end;
  finally
    restClient.Free;
    restRequest.Free;
  end;
end;
Workarounds
I have copied across the Delphi 10.0 Seattle REST.Client.pas & REST.HttpClient.pas into my local project.  These override the 10.1 Berlin dcu & outcome is as expected.
Attachment
None
Comments

Bruno LEDOUX at 9/22/2016 10:30:18 AM -
same problem with "THTTPClient" on iOS...
Ok on win32 platform but "EZDecompressionError" exception on iOS platform.

Project stopped !!!

Server Response from: ETNACODE01