【发布时间】:2021-06-14 17:03:21
【问题描述】:
我使用 WSDL 导入器来创建一个类 (Delphi 10.3)。但是在调用 Web 服务方法时出错。在使用 Fiddler 检查调用后,我注意到缺少一个属性。
在 WSDL 中我们有:
<s:complexType name="ArrayOfAnyType">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="anyType" nillable="true" type="s:string" />
</s:sequence>
</s:complexType>
工作的 SOAP 信封如下所示:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<FidelioSPMSWSXML xmlns="http://fideliocruise.de/">
<psFunction>Login</psFunction>
<poParam>
<anyType xsi:type="xsd:string">sasa</anyType>
<anyType xsi:type="xsd:string">F45731E3D39A1B2330BBF93E9B3DE59E</anyType>
</poParam>
</FidelioSPMSWSXML>
</s:Body>
</s:Envelope>
Delphi 像这样创建信封:
<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<FidelioSPMSWSXML xmlns="http://fideliocruise.de/">
<psFunction>Login</psFunction>
<psSessionID/>
<poParam>
<anyType>username</anyType>
<anyType>password</anyType>
</poParam>
</FidelioSPMSWSXML>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Delphi 调用不起作用的唯一原因是 anyType 元素中缺少 xsi:type="xsd:string" 。如何强制 Delphi 添加该属性?
【问题讨论】:
-
看起来像是导入器中的错误。不能修复生成的代码吗?
-
不,我正在尝试更改 htpr1BeforeExecute 中的 SOAP 信封
标签: delphi