我使用Delphi7,我需要在delphi中使用我之前在SSRS 2008中制作的一些报告。实际上我想在Delphi中调用它们。我使用了 WSDl 导入器并导入了 reportservice2005.asmx ,delphi 给了我一个包含 SSRS 方法列表的 PAS 文件,但是当我尝试使用 GetReportingService2010Soap 函数创建 ReportingService2010Soap 的实例时,给了我一些错误!有没有地方可以找到使用此 PAS 文件的文档? 谢谢你,请原谅我糟糕的英语!
最佳答案
Delphi 7 WSDL 导入器 (wsdlimp.exe) 有一个更新,可以从 Embarcadero ID: 24535, Delphi SOAP Runtime and Importer Update 下载
这里有 3 篇内容丰富的文章。无论是 Delphi 7 还是更新的版本,在 Delphi 中使用 ASMX Web 服务都非常简单。
1. Consuming C# Web Services with Delphi 7 Professional
2. Delphi 2010 and WCF Clients
3. Introduction to WCF Programming in Delphi
除此之外,在开发过程中,您可以将 Web 服务调用包含在 try except block 中,如下所示
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;
在此阶段,我们根据引发的异常中的 ClassName 和 Message 来调查问题,直到没有异常...然后我们可以检查其他事情(例如服务目前是否实际启动,解决、超时、性能、安全性等)。
关于delphi - 如何在 delphi 中通过 WSDL 使用 SSRS 方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6482619/