Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi XE2 HTTPRIO Unable to retrieve the URL endpoint for Service/Port

I am converting a Delphi 2007 program to Delphi XE2 and having a problem with the following error message:

Unable to retrieve the URL endpoint for service/port "/" from WSDL 'http://.....'

The service I am connecting to is written in Delphi 2007.

On 2007 it compiles and runs without problems. On XE2 with the same code it falls over with the error.

I have tried re-importing the interface using the new WSDL importer with defaults set but no joy.

I have also tried setting the port and service names and the error persists. Not sure what info is of use but as far as I can tell it is connecting.

This is the operation of the method that I am using

<operation name="CheckRegistration">
  <soap:operation soapAction="urn:ScubaUpdateWSIntf-IScubaUpdateWS#CheckRegistration" style="rpc"/>
  <input>
    <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"     namespace="urn:ScubaUpdateWSIntf-IScubaUpdateWS"/>
  </input>
  <output>
    <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:ScubaUpdateWSIntf-IScubaUpdateWS"/>
  </output>
</operation> 

This is the message:

<message name="CheckRegistration10Request">
  <part name="centreId" type="xs:int"/>
  <part name="centreName" type="xs:string"/>
  <part name="checkActiveOnly" type="xs:boolean"/>
</message>
<message name="CheckRegistration10Response">
  <part name="return" type="xs:boolean"/>
</message>

Apart from importing the WSDL, throwing on an HTTPRIO and calling the method with

(HTTPRIO1 as IScubaUpdateWS).CheckRegistration(strtoint(tcentre),tcentreName,true);

I don't think I am doing anything else and as I say the same code works on Delphi 2007.

like image 700
Richard Turner Avatar asked Jan 23 '12 15:01

Richard Turner


1 Answers

Solved. Well sort of! Seems like Delphi XE2 is finding 2 services where as Delphi 2007 is finding one. The program I am using is reading the WSDL location from the registry and setting it. On Delphi 2007 it is fine because it is taking the one and only service and making that selected port/service. On Delphi XE2 it is resetting the WSDL location has results in the port and service being cleared. Thanks to @JohnEasley for pointing me in the right direction. To solve I am now having to use the following code after changing the WSDL location. Not sure it will work for every one as I am assuming the first entry is the one that is required

servicenames:=Tdomstrings.Create;
portnames:=Tdomstrings.Create;
HTTPRIO1.WSDLItems.GetServices(servicenames);
if servicenames.count>0 then 
begin
 HTTPRIO1.Service:=servicenames[0];
 HTTPRIO1.WSDLItems.GetPortsForService(servicenames[0],portnames);
 if portnames.count>0 then
  HTTPRIO1.Port:=portnames[0];
end;
servicenames.clear;
servicenames.Free;
portnames.clear;
portnames.Free;

Thanks guys

like image 59
Richard Turner Avatar answered Sep 28 '22 10:09

Richard Turner