Delphi API Function Call (SOAP)

I got the API from the company we want to integrate using the provided WSDL. Here is the code snippet in the API in which I had a problem:

  AppointmentRequest = class(TRemotable)
  private
    FStartDate: TXSDateTime;
    FEndDate: TXSDateTime;
    FProperty_: Property_;
    FServiceIDs: ArrayOfInt;
  public
    destructor Destroy; override;
  published
    property StartDate: TXSDateTime read FStartDate write FStartDate;
    property EndDate: TXSDateTime read FEndDate write FEndDate;
    property Property_: Property_ read FProperty_ write FProperty_;
    property ServiceIDs: ArrayOfInt read FServiceIDs write FServiceIDs;
  end;

In my code, I am trying to set the Start and End Date property as follows:

  aApptReq  := c_xxx_API.AppointmentRequest.Create();
  aApptReq.StartDate.AsDateTime := Date();
  aApptReq.EndDate.AsDateTime := Date() + 7;

I believe that it worked at some point, but now it gives an access violation error in the address ... When I hover over aApptReq.StartDate (or EndDate), it displays as "nil".

I tried to do aApptReq.StartDate.Create (), but that did not help.

What am I missing in using this API object?

+3
source share
1 answer

You need to create the TXSDateTime element yourself.

aApptReq  := c_xxx_API.AppointmentRequest.Create();   
aApptReq.StartDate := TXSDateTime.Create;
aApptReq.StartDate.AsDateTime := Date;
+3
source

Source: https://habr.com/ru/post/1780759/


All Articles