Ric*_*ner 7 delphi wsdl webservice-client delphi-2010 delphi-xe2
我正在将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>
Run Code Online (Sandbox Code Playgroud)
这是消息:
<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>
Run Code Online (Sandbox Code Playgroud)
除了导入WSDL之外,抛出HTTPRIO并使用调用方法
(HTTPRIO1 as IScubaUpdateWS).CheckRegistration(strtoint(tcentre),tcentreName,true);
Run Code Online (Sandbox Code Playgroud)
我不认为我正在做任何其他事情,因为我说同样的代码适用于Delphi 2007.
解决了。嗯,有点像!看起来 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;
Run Code Online (Sandbox Code Playgroud)
多谢你们
| 归档时间: |
|
| 查看次数: |
7123 次 |
| 最近记录: |