加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

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

发布时间:2020-12-15 09:31:13 所属栏目:大数据 来源:网络整理
导读:我在通过SOAP WebService公开DTO类时遇到了问题. 我的班级看起来像 TKontrahent = classpublic Imie : string; Nazwisko : string; Id : integer;end; 这是服务的代码: TKontrahentService = class(TInvokableClass,IKontrahentService)public function Dod
我在通过SOAP WebService公开DTO类时遇到了问题.

我的班级看起来像

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>

我会感谢任何建议.我找不到任何更复杂类型的样本.
最好的祝福,
krlm

解决方法

要在标准Delphi SOAP服务中公开和使用类TKontrahent,它必须是 TRemotable的子类,并且必须发布其属性.

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读