4
votes

I use Delphi7 and I need to use some reports I have made before in SSRS 2008 within delphi.Actually I want to call them within Delphi. I have Used a WSDl importer and imported reportservice2005.asmx and delphi gave me a PAS file with list of SSRS methods but when I try to create an instance of ReportingService2010Soap with GetReportingService2010Soap Function gives me some errors!. Is there anywhere to find a Document for using this PAS file? thank you and excuse my bad English!

1
Hi Arash, what errors are you getting? What's the text of the error message?Sam

1 Answers

3
votes

The Delphi 7 WSDL Importer (wsdlimp.exe) has an update that can be downloaded from Embarcadero ID: 24535, Delphi SOAP Runtime and Importer Update

Here are 3 informative articles. Consuming ASMX web services in Delphi is pretty simple whether it's Delphi 7 or a more recent version.

1. Consuming C# Web Services with Delphi 7 Professional

2. Delphi 2010 and WCF Clients

3. Introduction to WCF Programming in Delphi

Apart from that, during development you can enclose your web service calls in a try except block like this

uses
  SysUtils,
  ABCService; // .pas unit generated by WSDLIMP.EXE (WSDL Importer)

procedure PerformServiceCall;
var
  MyService: IMyService;
  MyServiceResponse: TMyServiceResponse; // the result returned from the service call
  MyServiceRequest: TMyServiceRequest;   // the parameter passed with the service call
  Connected: boolean;
begin
  MyService := nil;
  try
    try
      MyService := IMyService.GetMyService;
      Connected := (MyService <> nil);
      if Connected then
        MyServiceResponse := MyService.MethodName(MyServiceRequest);
      else
        raise Exception.Create('Could Not Connect');
    except
      on E: Exception do
        ShowMessage(E.ClassName + #13#10 + E.Message);
    end;
  finally
    MyService := nil;
  end;
end;

At this stage we investigate issues according to the ClassName and Message in the Exception raised, until we get no exceptions... then there are other things that we could check (like whether the service is actually up at the moment, addressing, timeouts, performance, security, etc.).