gpt4 book ai didi

delphi - 如何在 Delphi WebService 中公开复杂类型

转载 作者:行者123 更新时间:2023-12-03 15:09:35 26 4
gpt4 key购买 nike

我在通过 SOAP WebService 公开 DTO 类时遇到问题。

我的类(class)看起来像

TKontrahent = class
public
Imie : string;
Nazwisko : string;
Id : integer;
end;

这是服务的代码:

TKontrahentService = class(TInvokableClass, IKontrahentService)
public
function Dodaj( kontrahnet : TKontrahent) : integer; stdcall;
function Aktualizuj ( kontrahent : TKontrahent) : integer; stdcall;
function Usun ( kontrahent : TKontrahent) : integer; stdcall;
function Nowy : TKontrahent; stdcall;
end;

以及如何在 WSDL 中发布该类型:

<types>
<xs:schema targetNamespace="urn:Kontrahent" xmlns="urn:Kontrahent">
<xs:complexType name="TKontrahent">
<xs:sequence/>
</xs:complexType>
</xs:schema>
</types>

如果有任何建议,我将不胜感激。我找不到任何具有更复杂类型的示例。此致,克尔姆

最佳答案

要在标准 Delphi SOAP 服务中公开和使用 TKontrahent 类,它必须是 TRemotable 的子类。及其属性必须公开。

作为起点(例如从 Delphi 7 迁移到 2009 之后),我通常导入现有的 WSDL 来创建 SOAP 客户端并研究生成的类和属性的源代码。

关于delphi - 如何在 Delphi WebService 中公开复杂类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6662390/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com