0

We are using RAD Studio 10.0 Seattle to build an iOS App that gets data via web services. Since Apple requires all apps to support IPv6 from 1 Jun 2016, our App update has been rejected.

We are using the WSDL Importer to create the web service class in RAD Studio and then call the web services. When the app connects to an IPv6 network, it throws a Socket Error #51 Network is unreachable....

Does anyone know how we could fix this issue?

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
Cheez
  • 1
  • 1
  • 3
    There is no XE10. Are you using 10.0 Seattle, or 10.1 Berlin? In any case, you should contact Embarcadero for help, they will probably have to provide a fix for IPv6 support. Otherwise, you may have to stop using their WebService framework and write your own WebService from scratch, such as with Indy's `TIdHTTPServer`, which supports IPv6. – Remy Lebeau Aug 24 '16 at 04:21
  • 1
    @Remy I even had to correct the authors of QuickReports because they had distributed their latest version widely using "XE10" all over the place. Also, for all we know, 10.1 Berlin might have introduced a fix already which was not in 10.0 Seattle. – Jerry Dodge Aug 24 '16 at 16:46
  • Thanks @RemyLebeau for the correction. I'm using 10.0 Seattle. We will try to contact Embarcadero to see if they have a fix for that. – Cheez Aug 25 '16 at 04:05
  • @RemyLebeau Apart from rewriting using TIdHTTPServer, is there any other ways to fix the issue? What about using Rest API instead of Web Services? Please advice. Thanks – Cheez Aug 25 '16 at 04:18
  • @Cheez: I can't answer your question, since I can't see what Embarcadero's framework does internally, or if it has potentially already been addressed in 10.1 Berlin. That is why I suggest you contact Embarcadero for support. Either this is a bug that they need to fix in Seattle, or maybe there is already a solution you can use to switch the framework to IPv6. – Remy Lebeau Aug 25 '16 at 04:23

2 Answers2

0

Try with this func:

function GetHost(Host: String): Boolean;
begin
  result := '';
  try
    GStack.ResolveHost(Host, TIdIPVersion.Id_IPv6);
    result := '[' + Host + ']';
  except
    GStack.ResolveHost(Host, TIdIPVersion.Id_IPv4);
    result := Host;
  end;
end;

Add in your Uses "IdStack" and "IdGlobal"

you must pass your host (www.google.com for example) and the func return a result with or without '['.

Now, you must just use it... 'http://' + getHost('www.google.com')

if you are in IPV6 network the final string will be (http://[www.google.com])

Marco G.
  • 1
  • 1
0

Using the previous answer I came up with this code, which works for me. I can enter the full soap URL and it returns a correct IPV4 of IPV6 URL. Include 'idURI' in the uses section.

class function TPortalTools.GetRealUrl(Url: string): string;
var
  IdURI: TIdURI;
begin
  TIdStack.IncUsage;
  IdURI := TIdURI.Create(Url);
  try
    try
      GStack.ResolveHost(IdURI.Host, TIdIPVersion.Id_IPv6);
      IdURI.IPVersion := TIdIPVersion.Id_IPv6;
    except
      IdURI.IPVersion := TIdIPVersion.Id_IPv4; // Just in case.
    end;

    // Put it back together.
    Result := IdURI.GetFullURI([]);
  finally
    FreeAndNil(IdURI);
    TIdStack.DecUsage;
  end;
end;