My Delphi XE6 project needs to call SOAP-based webservices. Unfortunately it seems that there may be a problem performing such webservice calls from 64-bit DLLs under IIS, which is how my project will be deployed.
See for example the following public webservice:
http://www.webservicex.net/geoipservice.asmx?WSDL
After creating a test ISAPI webserver project and importing the WSDL above, I tried using the following code to make a webservice call:
uses activeX, geoipservice;
procedure TWebModule1.WebModule1DefaultHandlerAction(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var
CountryName : string;
I : GeoIPServiceSoap;
G : GeoIP2;
begin
CoInitialize(nil);
try
CountryName := 'unassigned';
I := GetGeoIPServiceSoap();
if assigned(I) then begin
G := I.GetGeoIP('...insert IP address here...');
if assigned(G) then begin
countryname := G.CountryName;
end;
end;
Response.Content :=
'<html>' +
'<head><title>Web Service Test</title></head>' +
'<body>Country: ' + CountryName + '</body>' +
'</html>';
except
on E : exception do begin
Response.Content :=
'<html>' +
'<head><title>Web Service Test</title></head>' +
'<body>Exception: ' + E.ClassName() + ' ' + E.Message + '</body>' +
'</html>';
end;
end;
CoUninitialize();
end;
When I run the project as a 32-bit ISAPI DLL, viewing the website in a browser results in a country name being displayed as expected. When I run the project as a 64-bit ISAPI DLL, viewing the website in a browser results in the following error message being displayed (Zugriffsverletzung = access violation):
Exception: EAccessViolation Zugriffsverletzung bei Adresse 000000C700492460. Schreiben von Adresse 000000C700492460
This seems very similar to the following problem:
Delphi XE2 64 bit ISAPI Access Violation
However the problem there relates to Delphi XE2, and it is stated that upgrading to Delphi XE4 fixed the problem. I have tested in both Delphi XE4 and XE6 and the problem occurs in both.
Has anybody else encountered this problem or has an idea how to solve it?
Setup: Delphi XE6, Win8.1, IIS 8.5