Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to expose a complex type in a Delphi WebService

I've got a problem with exposing a DTO class through SOAP WebService.

My class looks like

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

Here's the Service's code:

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;

And how the type is published in WSDL:

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

I'd be thankful for any advices. I cannot find any sample with more complex types. Best regards, krlm

like image 988
krlm Avatar asked Jul 12 '11 09:07

krlm


1 Answers

To expose and consume the class TKontrahent in a standard Delphi SOAP service, it must be a subclass of TRemotable and its properties must be published.

As a starting point (for example after the migration from Delphi 7 to 2009) I usually import an existing WSDL to create a SOAP client and study the generated source code for classes and properties.

like image 86
mjn Avatar answered Oct 16 '22 02:10

mjn