开发者

Delphi Calling an API Function (SOAP)

I have retrieved an API from a company that we are looking to integrate with using their provided WSDL. Here is the snippet of code in the API in w开发者_如何学JAVAhich I am having an issue:

  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 attempting to set the Start & End Date property as follows:

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

I believe this worked at one point but now throws an error of Access Violation at Address... When I hover over aApptReq.StartDate (or EndDate) it shows as 'nil'.

I tried to do aApptReq.StartDate.Create() but that didn't help.

What am I missing in using this API object?


You need to create the TXSDateTime element yourself.

aApptReq  := c_xxx_API.AppointmentRequest.Create();   
aApptReq.StartDate := TXSDateTime.Create;
aApptReq.StartDate.AsDateTime := Date;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜