【问题标题】:Delphi Calling an API Function (SOAP)Delphi 调用 API 函数 (SOAP)
【发布时间】:2010-12-17 05:39:14
【问题描述】:

我从一家公司检索了一个 API,我们希望使用他们提供的 WSDL 与之集成。这是我遇到问题的 API 中代码的 sn-p:

  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;

在我的代码中,我尝试如下设置开始和结束日期属性:

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

我相信这在某个时候有效,但现在在地址处引发访问冲突错误...当我将鼠标悬停在 aApptReq.StartDate(或 EndDate)上时,它显示为“nil”。

我尝试执行 aApptReq.StartDate.Create() 但这没有帮助。

我在使用这个 API 对象时遗漏了什么?

【问题讨论】:

    标签: delphi api soap


    【解决方案1】:

    您需要自己创建 TXSDateTime 元素。

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

    【讨论】:

    • 非常感谢您的快速回复。这正是我需要做的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-07-06
    相关资源
    最近更新 更多