Delphi XE2 HTTPRIO 无法检索服务/端口的 URL 端点

发布于 2024-12-28 07:09:54 字数 1468 浏览 4 评论 0原文

我正在将 Delphi 2007 程序转换为 Delphi XE2,但遇到以下错误消息:

无法从 WSDL“http://.....”检索服务/端口“/”的 URL 端点

我连接的服务是用 Delphi 2007 编写的。

在 2007 年,它编译和运行没有问题。 在具有相同代码的 XE2 上,它会因错误而失败。

我尝试过使用新的 WSDL 导入器并设置了默认值来重新导入界面,但没有什么乐趣。

我还尝试设置端口和服务名称,但错误仍然存​​在。不确定哪些信息有用,但据我所知它正在连接。

这是我正在使用的方法的操作

<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> 

这是消息:

<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>

除了导入 WSDL、抛出 HTTPRIO 并调用该方法之外,

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

我认为我没有做任何其他事情,正如我所说,相同的代码适用于德尔福2007。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

却一份温柔 2025-01-04 07:09:54

解决了。嗯,有点像!
看起来 Delphi XE2 正在寻找 2 项服务,而 Delphi 2007 正在寻找一项服务。
我正在使用的程序从注册表中读取 WSDL 位置并进行设置。在 Delphi 2007 上,这很好,因为它采用唯一的服务并创建选定的端口/服务。在 Delphi XE2 上,重置 WSDL 位置会导致端口和服务被清除。
感谢@JohnEasley 为我指明了正确的方向。
为了解决这个问题,我现在必须在更改 WSDL 位置后使用以下代码。
不确定它是否适用于每个人,因为我假设第一个条目是必需的

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;

谢谢大家

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

梦冥 2025-01-04 07:09:54

在delphi 10.3中,您必须在运行时显式设置“HTTPRIO1”的属性“Port”和“WSDLLocation”。

对于“创建”事件表单中的示例:

HTTPRIO1.WSDLLocation:=defWSDL; 
//HTTPRIO1.URL:=defURL;    
//one of URL or WSDLLocation is enough.    
HTTPRIO1.Service:=defSvc;     
HTTPRIO1.Port:=defPrt;     

谢谢

in delphi 10.3 you must set "HTTPRIO1"'s property "Port" and "WSDLLocation" explicitly at runtime.

for sample in form "create" event:

HTTPRIO1.WSDLLocation:=defWSDL; 
//HTTPRIO1.URL:=defURL;    
//one of URL or WSDLLocation is enough.    
HTTPRIO1.Service:=defSvc;     
HTTPRIO1.Port:=defPrt;     

Thanks

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文