Delphi 2010 中的访问冲突设置 Web 服务元素值

Access violation setting web service element value in Delphi 2010

我正在尝试在下面的代码中设置 vRequest.odfl4Me.user 的值。当我 运行 它尝试执行该行时,我收到访问冲突写入错误。我认为这是因为 user 是对象 ofodfl4me 的 属性,它是 bolRequest 的对象。我假设我没有正确创建它。提前谢谢你。

procedure TForm1.Button1Click(Sender: TObject);
var
  WS: ODPickup_v2_0;
  vRequest: bolRequest;
  vResponse: bolResponse;
begin
  WS := ODPickup.GetODPickup_v2_0();
  vRequest := bolRequest.Create;
  vResponse:= bolResponse.Create;
  try
    vRequest.odfl4Me.user := 'test';    // Access violation on this line
    vResponse := WS.getBillOfLading(vRequest);
    ShowMessage(vResponse.bolReturn.odflTrackingNumber);
  finally
    WS := nil;
    vResponse.Free;
    vRequest.Free;
  end;
end;

WSDL 导入向导生成的 ODPickup.pas 代码在这里:

unit ODPickup;

interface
uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;

const
  IS_OPTN = [=12=]01;
  IS_UNBD = [=12=]02;
  IS_NLBL = [=12=]04;
  IS_UNQL = [=12=]08;
  IS_REF  = [=12=]80;

type
  Accessorial          = class;                 { "http://odfl.com/ws/ODPickup-v2.0"[GblCplx] }
  Customer             = class;                 { "http://odfl.com/ws/ODPickup-v2.0"[GblCplx] }
  CodDetail            = class;                 { "http://odfl.com/ws/ODPickup-v2.0"[GblCplx] }
  ShipmentRefId        = class;                 { "http://odfl.com/ws/ODPickup-v2.0"[GblCplx] }
  Consignee            = class;                 { "http://odfl.com/ws/ODPickup-v2.0"[GblCplx] }
  Odfl4Me              = class;                 { "http://odfl.com/ws/ODPickup-v2.0"[GblCplx] }
  pickupResponse       = class;                 { "http://odfl.com/ws/ODPickup-v2.0"[Lit][GblElm] }
  pickupRequest        = class;                 { "http://odfl.com/ws/ODPickup-v2.0"[Lit][GblElm] }
  bolResponse          = class;                 { "http://odfl.com/ws/ODPickup-v2.0"[Lit][GblElm] }
  bolRequest           = class;                 { "http://odfl.com/ws/ODPickup-v2.0"[Lit][GblElm] }
  BolDetail            = class;                 { "http://odfl.com/ws/ODPickup-v2.0"[GblCplx] }
  Commodity            = class;                 { "http://odfl.com/ws/ODPickup-v2.0"[GblCplx] }
  BolResult            = class;                 { "http://odfl.com/ws/ODPickup-v2.0"[GblCplx] }
  ConsigneeResult      = class;                 { "http://odfl.com/ws/ODPickup-v2.0"[GblCplx] }


  Accessorial = class(TRemotable)
  private
    Fcode: string;
    Fvalue: string;
  published
    property code:  string  Index (IS_NLBL or IS_UNQL) read Fcode write Fcode;
    property value: string  Index (IS_NLBL or IS_UNQL) read Fvalue write Fvalue;
  end;


  Customer = class(TRemotable)
  private
    FaccountNumber: string;
    FcompanyName: string;
    FaddressLine1: string;
    FaddressLine2: string;
    Fcity: string;
    FstateProvince: string;
    FpostalCode: string;
    Fcountry: string;
    FphoneAreaCode: string;
    FphoneNumber: string;
    FphoneExt: string;
    FfaxAreaCode: string;
    FfaxNumber: string;
    Fattention: string;
    FcontactFName: string;
    FcontactLName: string;
    Femail: string;
    Fcomments: string;
  published
    property accountNumber: string  Index (IS_NLBL or IS_UNQL) read FaccountNumber write FaccountNumber;
    property companyName:   string  Index (IS_NLBL or IS_UNQL) read FcompanyName write FcompanyName;
    property addressLine1:  string  Index (IS_NLBL or IS_UNQL) read FaddressLine1 write FaddressLine1;
    property addressLine2:  string  Index (IS_NLBL or IS_UNQL) read FaddressLine2 write FaddressLine2;
    property city:          string  Index (IS_NLBL or IS_UNQL) read Fcity write Fcity;
    property stateProvince: string  Index (IS_NLBL or IS_UNQL) read FstateProvince write FstateProvince;
    property postalCode:    string  Index (IS_NLBL or IS_UNQL) read FpostalCode write FpostalCode;
    property country:       string  Index (IS_NLBL or IS_UNQL) read Fcountry write Fcountry;
    property phoneAreaCode: string  Index (IS_NLBL or IS_UNQL) read FphoneAreaCode write FphoneAreaCode;
    property phoneNumber:   string  Index (IS_NLBL or IS_UNQL) read FphoneNumber write FphoneNumber;
    property phoneExt:      string  Index (IS_NLBL or IS_UNQL) read FphoneExt write FphoneExt;
    property faxAreaCode:   string  Index (IS_NLBL or IS_UNQL) read FfaxAreaCode write FfaxAreaCode;
    property faxNumber:     string  Index (IS_NLBL or IS_UNQL) read FfaxNumber write FfaxNumber;
    property attention:     string  Index (IS_NLBL or IS_UNQL) read Fattention write Fattention;
    property contactFName:  string  Index (IS_NLBL or IS_UNQL) read FcontactFName write FcontactFName;
    property contactLName:  string  Index (IS_NLBL or IS_UNQL) read FcontactLName write FcontactLName;
    property email:         string  Index (IS_NLBL or IS_UNQL) read Femail write Femail;
    property comments:      string  Index (IS_NLBL or IS_UNQL) read Fcomments write Fcomments;
  end;


  CodDetail = class(TRemotable)
  private
    Famount: string;
    FpaymentMethod: string;
    FcodFee: string;
    FremitTo: string;
    FaddressLine1: string;
    FaddressLine2: string;
    Fcity: string;
    FstateProvince: string;
    FpostalCode: string;
    Fcountry: string;
    Fattention: string;
  published
    property amount:        string  Index (IS_NLBL or IS_UNQL) read Famount write Famount;
    property paymentMethod: string  Index (IS_NLBL or IS_UNQL) read FpaymentMethod write FpaymentMethod;
    property codFee:        string  Index (IS_NLBL or IS_UNQL) read FcodFee write FcodFee;
    property remitTo:       string  Index (IS_NLBL or IS_UNQL) read FremitTo write FremitTo;
    property addressLine1:  string  Index (IS_NLBL or IS_UNQL) read FaddressLine1 write FaddressLine1;
    property addressLine2:  string  Index (IS_NLBL or IS_UNQL) read FaddressLine2 write FaddressLine2;
    property city:          string  Index (IS_NLBL or IS_UNQL) read Fcity write Fcity;
    property stateProvince: string  Index (IS_NLBL or IS_UNQL) read FstateProvince write FstateProvince;
    property postalCode:    string  Index (IS_NLBL or IS_UNQL) read FpostalCode write FpostalCode;
    property country:       string  Index (IS_NLBL or IS_UNQL) read Fcountry write Fcountry;
    property attention:     string  Index (IS_NLBL or IS_UNQL) read Fattention write Fattention;
  end;


  ShipmentRefId = class(TRemotable)
  private
    FreferenceId: string;
    FidQualifier: string;
    FpoDepartment: string;
  published
    property referenceId:  string  Index (IS_NLBL or IS_UNQL) read FreferenceId write FreferenceId;
    property idQualifier:  string  Index (IS_NLBL or IS_UNQL) read FidQualifier write FidQualifier;
    property poDepartment: string  Index (IS_NLBL or IS_UNQL) read FpoDepartment write FpoDepartment;
  end;


  Consignee = class(TRemotable)
  private
    FconsigneeDetail: Customer;
    FshipmentDetail: Commodity;
  public
    destructor Destroy; override;
  published
    property consigneeDetail: Customer   Index (IS_NLBL or IS_UNQL) read FconsigneeDetail write FconsigneeDetail;
    property shipmentDetail:  Commodity  Index (IS_NLBL or IS_UNQL) read FshipmentDetail write FshipmentDetail;
  end;

  Odfl4Me = class(TRemotable)
  private
    Fuser: string;
    Fpassword: string;
  published
    property user:     string  Index (IS_NLBL or IS_UNQL) read Fuser write Fuser;
    property password: string  Index (IS_NLBL or IS_UNQL) read Fpassword write Fpassword;
  end;


  bolResponse = class(TRemotable)
  private
    FbolReturn: BolResult;
  public
    constructor Create; override;
    destructor Destroy; override;
  published
    property bolReturn: BolResult  Index (IS_NLBL or IS_UNQL) read FbolReturn write FbolReturn;
  end;


 bolRequest = class(TRemotable)
  private
    Fodfl4Me: Odfl4Me;
    FbolDetail: BolDetail;
  public
    constructor Create; override;
    destructor Destroy; override;
  published
    property odfl4Me:   Odfl4Me    Index (IS_NLBL or IS_UNQL) read Fodfl4Me write Fodfl4Me;
    property bolDetail: BolDetail  Index (IS_NLBL or IS_UNQL) read FbolDetail write FbolDetail;
  end;

  Array_Of_Accessorial = array of Accessorial;   { "http://odfl.com/ws/ODPickup-v2.0"[GblUbnd] }
  Array_Of_Commodity = array of Commodity;      { "http://odfl.com/ws/ODPickup-v2.0"[GblUbnd] }


  BolDetail = class(TRemotable)
  private
    FcontactName: string;
    FcontactPhoneAreaCode: string;
    FcontactPhoneNumber: string;
    FcontactPhoneExt: string;
    FpickupDate: string;
    FpickupTime: string;
    FpickupTimeAMPM: string;
    FdockCloseTime: string;
    FdockCloseAMPM: string;
    FcallForAppointment: Boolean;
    FpaymentType: string;
    FbolNumber: string;
    FreferenceNumber: string;
    FrequestGuaranteedRate: Boolean;
    FpickupInstruction: string;
    FbolComments: string;
    Fshipper: Customer;
    Fconsignee: Customer;
    FbillTo: Customer;
    FcodDetails: CodDetail;
    Faccessorials: Array_Of_Accessorial;
    Faccessorials_Specified: boolean;
    FhandlingUnits: string;
    Fcommodities: Array_Of_Commodity;
    Fcommodities_Specified: boolean;
    FhazMatContactName: string;
    FhazMatContactPhone: string;
    FrateReferenceNumber: string;
    FemailDeliveryConfirm: string;
    FemailBol: string;
    FtestFlag: Boolean;
    procedure Setaccessorials(Index: Integer; const AArray_Of_Accessorial: Array_Of_Accessorial);
    function  accessorials_Specified(Index: Integer): boolean;
    procedure Setcommodities(Index: Integer; const AArray_Of_Commodity: Array_Of_Commodity);
    function  commodities_Specified(Index: Integer): boolean;
  public
    destructor Destroy; override;
  published
    property contactName:           string                Index (IS_NLBL or IS_UNQL) read FcontactName write FcontactName;
    property contactPhoneAreaCode:  string                Index (IS_NLBL or IS_UNQL) read FcontactPhoneAreaCode write FcontactPhoneAreaCode;
    property contactPhoneNumber:    string                Index (IS_NLBL or IS_UNQL) read FcontactPhoneNumber write FcontactPhoneNumber;
    property contactPhoneExt:       string                Index (IS_NLBL or IS_UNQL) read FcontactPhoneExt write FcontactPhoneExt;
    property pickupDate:            string                Index (IS_NLBL or IS_UNQL) read FpickupDate write FpickupDate;
    property pickupTime:            string                Index (IS_NLBL or IS_UNQL) read FpickupTime write FpickupTime;
    property pickupTimeAMPM:        string                Index (IS_NLBL or IS_UNQL) read FpickupTimeAMPM write FpickupTimeAMPM;
    property dockCloseTime:         string                Index (IS_NLBL or IS_UNQL) read FdockCloseTime write FdockCloseTime;
    property dockCloseAMPM:         string                Index (IS_NLBL or IS_UNQL) read FdockCloseAMPM write FdockCloseAMPM;
    property callForAppointment:    Boolean               Index (IS_UNQL) read FcallForAppointment write FcallForAppointment;
    property paymentType:           string                Index (IS_NLBL or IS_UNQL) read FpaymentType write FpaymentType;
    property bolNumber:             string                Index (IS_NLBL or IS_UNQL) read FbolNumber write FbolNumber;
    property referenceNumber:       string                Index (IS_NLBL or IS_UNQL) read FreferenceNumber write FreferenceNumber;
    property requestGuaranteedRate: Boolean               Index (IS_UNQL) read FrequestGuaranteedRate write FrequestGuaranteedRate;
    property pickupInstruction:     string                Index (IS_NLBL or IS_UNQL) read FpickupInstruction write FpickupInstruction;
    property bolComments:           string                Index (IS_NLBL or IS_UNQL) read FbolComments write FbolComments;
    property shipper:               Customer              Index (IS_NLBL or IS_UNQL) read Fshipper write Fshipper;
    property consignee:             Customer              Index (IS_NLBL or IS_UNQL) read Fconsignee write Fconsignee;
    property billTo:                Customer              Index (IS_NLBL or IS_UNQL) read FbillTo write FbillTo;
    property codDetails:            CodDetail             Index (IS_NLBL or IS_UNQL) read FcodDetails write FcodDetails;
    property accessorials:          Array_Of_Accessorial  Index (IS_OPTN or IS_UNBD or IS_NLBL or IS_UNQL) read Faccessorials write Setaccessorials stored accessorials_Specified;
    property handlingUnits:         string                Index (IS_NLBL or IS_UNQL) read FhandlingUnits write FhandlingUnits;
    property commodities:           Array_Of_Commodity    Index (IS_OPTN or IS_UNBD or IS_NLBL or IS_UNQL) read Fcommodities write Setcommodities stored commodities_Specified;
    property hazMatContactName:     string                Index (IS_NLBL or IS_UNQL) read FhazMatContactName write FhazMatContactName;
    property hazMatContactPhone:    string                Index (IS_NLBL or IS_UNQL) read FhazMatContactPhone write FhazMatContactPhone;
    property rateReferenceNumber:   string                Index (IS_NLBL or IS_UNQL) read FrateReferenceNumber write FrateReferenceNumber;
    property emailDeliveryConfirm:  string                Index (IS_NLBL or IS_UNQL) read FemailDeliveryConfirm write FemailDeliveryConfirm;
    property emailBol:              string                Index (IS_NLBL or IS_UNQL) read FemailBol write FemailBol;
    property testFlag:              Boolean               Index (IS_UNQL) read FtestFlag write FtestFlag;
  end;

  Array_Of_ShipmentRefId = array of ShipmentRefId;   { "http://odfl.com/ws/ODPickup-v2.0"[GblUbnd] }


  Commodity = class(TRemotable)
  private
    Fpieces: string;
    FunitType: string;
    Fweight: string;
    Fhazmat: Boolean;
    Ffreezable: Boolean;
    FlongDescription: string;
    FshortDescription: string;
    FshipmentRefIds: Array_Of_ShipmentRefId;
    FshipmentRefIds_Specified: boolean;
    FnmfcCode: string;
    FnmfcSubCode: string;
    FnmfcClass: string;
    procedure SetshipmentRefIds(Index: Integer; const AArray_Of_ShipmentRefId: Array_Of_ShipmentRefId);
    function  shipmentRefIds_Specified(Index: Integer): boolean;
  public
    destructor Destroy; override;
  published
    property pieces:           string                  Index (IS_NLBL or IS_UNQL) read Fpieces write Fpieces;
    property unitType:         string                  Index (IS_NLBL or IS_UNQL) read FunitType write FunitType;
    property weight:           string                  Index (IS_NLBL or IS_UNQL) read Fweight write Fweight;
    property hazmat:           Boolean                 Index (IS_UNQL) read Fhazmat write Fhazmat;
    property freezable:        Boolean                 Index (IS_UNQL) read Ffreezable write Ffreezable;
    property longDescription:  string                  Index (IS_NLBL or IS_UNQL) read FlongDescription write FlongDescription;
    property shortDescription: string                  Index (IS_NLBL or IS_UNQL) read FshortDescription write FshortDescription;
    property shipmentRefIds:   Array_Of_ShipmentRefId  Index (IS_OPTN or IS_UNBD or IS_NLBL or IS_UNQL) read FshipmentRefIds write SetshipmentRefIds stored shipmentRefIds_Specified;
    property nmfcCode:         string                  Index (IS_NLBL or IS_UNQL) read FnmfcCode write FnmfcCode;
    property nmfcSubCode:      string                  Index (IS_NLBL or IS_UNQL) read FnmfcSubCode write FnmfcSubCode;
    property nmfcClass:        string                  Index (IS_NLBL or IS_UNQL) read FnmfcClass write FnmfcClass;
  end;

  Array_Of_string = array of string;            { "http://www.w3.org/2001/XMLSchema"[GblUbnd] }


  BolResult = class(TRemotable)
  private
    FodflTrackingNumber: string;
    FerrorMessages: Array_Of_string;
    FerrorMessages_Specified: boolean;
    procedure SeterrorMessages(Index: Integer; const AArray_Of_string: Array_Of_string);
    function  errorMessages_Specified(Index: Integer): boolean;
  published
    property odflTrackingNumber: string           Index (IS_NLBL or IS_UNQL) read FodflTrackingNumber write FodflTrackingNumber;
    property errorMessages:      Array_Of_string  Index (IS_OPTN or IS_UNBD or IS_NLBL or IS_UNQL) read FerrorMessages write SeterrorMessages stored errorMessages_Specified;
  end;



  ConsigneeResult = class(TRemotable)
  private
    FsequenceNumber: string;
    FodflTrackingNumber: string;
    FerrorMessages: Array_Of_string;
    FerrorMessages_Specified: boolean;
    procedure SeterrorMessages(Index: Integer; const AArray_Of_string: Array_Of_string);
    function  errorMessages_Specified(Index: Integer): boolean;
  published
    property sequenceNumber:     string           Index (IS_NLBL or IS_UNQL) read FsequenceNumber write FsequenceNumber;
    property odflTrackingNumber: string           Index (IS_NLBL or IS_UNQL) read FodflTrackingNumber write FodflTrackingNumber;
    property errorMessages:      Array_Of_string  Index (IS_OPTN or IS_UNBD or IS_UNQL) read FerrorMessages write SeterrorMessages stored errorMessages_Specified;
  end;

  Array_Of_Consignee = array of Consignee;      { "http://odfl.com/ws/ODPickup-v2.0"[GblUbnd] }



  ODPickup_v2_0 = interface(IInvokable)
  ['{0E054705-9C47-AE2E-0D6E-8032B5475822}']

    // Cannot unwrap: 
    //     - Input element wrapper name does not match operation's name
    function  getBillOfLading(const parameters: bolRequest): bolResponse; stdcall;
  end;

function GetODPickup_v2_0(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): ODPickup_v2_0;


implementation
  uses SysUtils;

function GetODPickup_v2_0(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): ODPickup_v2_0;
const
  defWSDL = 'https://www.odfl.com/wsPickup_v2/services/ODPickup?wsdl';
  defURL  = 'https://www.odfl.com:443/wsPickup_v2/services/ODPickup';
  defSvc  = 'ODPickup_v2_0';
  defPrt  = 'ODPickup';
var
  RIO: THTTPRIO;
begin
  Result := nil;
  if (Addr = '') then
  begin
    if UseWSDL then
      Addr := defWSDL
    else
      Addr := defURL;
  end;
  if HTTPRIO = nil then
    RIO := THTTPRIO.Create(nil)
  else
    RIO := HTTPRIO;
  try
    Result := (RIO as ODPickup_v2_0);
    if UseWSDL then
    begin
      RIO.WSDLLocation := Addr;
      RIO.Service := defSvc;
      RIO.Port := defPrt;
    end else
      RIO.URL := Addr;
  finally
    if (Result = nil) and (HTTPRIO = nil) then
      RIO.Free;
  end;
end;


destructor Consignee.Destroy;
begin
  SysUtils.FreeAndNil(FconsigneeDetail);
  SysUtils.FreeAndNil(FshipmentDetail);
  inherited Destroy;
end;

constructor bolResponse.Create;
begin
  inherited Create;
  FSerializationOptions := [xoLiteralParam];
end;

destructor bolResponse.Destroy;
begin
  SysUtils.FreeAndNil(FbolReturn);
  inherited Destroy;
end;

constructor bolRequest.Create;
begin
  inherited Create;
  FSerializationOptions := [xoLiteralParam];
end;

destructor bolRequest.Destroy;
begin
  SysUtils.FreeAndNil(Fodfl4Me);
  SysUtils.FreeAndNil(FbolDetail);
  inherited Destroy;
end;

destructor BolDetail.Destroy;
var
  I: Integer;
begin
  for I := 0 to System.Length(Faccessorials)-1 do
    SysUtils.FreeAndNil(Faccessorials[I]);
  System.SetLength(Faccessorials, 0);
  for I := 0 to System.Length(Fcommodities)-1 do
    SysUtils.FreeAndNil(Fcommodities[I]);
  System.SetLength(Fcommodities, 0);
  SysUtils.FreeAndNil(Fshipper);
  SysUtils.FreeAndNil(Fconsignee);
  SysUtils.FreeAndNil(FbillTo);
  SysUtils.FreeAndNil(FcodDetails);
  inherited Destroy;
end;

procedure BolDetail.Setaccessorials(Index: Integer; const AArray_Of_Accessorial: Array_Of_Accessorial);
begin
  Faccessorials := AArray_Of_Accessorial;
  Faccessorials_Specified := True;
end;

function BolDetail.accessorials_Specified(Index: Integer): boolean;
begin
  Result := Faccessorials_Specified;
end;

procedure BolDetail.Setcommodities(Index: Integer; const AArray_Of_Commodity: Array_Of_Commodity);
begin
  Fcommodities := AArray_Of_Commodity;
  Fcommodities_Specified := True;
end;

function BolDetail.commodities_Specified(Index: Integer): boolean;
begin
  Result := Fcommodities_Specified;
end;

destructor Commodity.Destroy;
var
  I: Integer;
begin
  for I := 0 to System.Length(FshipmentRefIds)-1 do
    SysUtils.FreeAndNil(FshipmentRefIds[I]);
  System.SetLength(FshipmentRefIds, 0);
  inherited Destroy;
end;

procedure Commodity.SetshipmentRefIds(Index: Integer; const AArray_Of_ShipmentRefId: Array_Of_ShipmentRefId);
begin
  FshipmentRefIds := AArray_Of_ShipmentRefId;
  FshipmentRefIds_Specified := True;
end;

function Commodity.shipmentRefIds_Specified(Index: Integer): boolean;
begin
  Result := FshipmentRefIds_Specified;
end;

procedure BolResult.SeterrorMessages(Index: Integer; const AArray_Of_string: Array_Of_string);
begin
  FerrorMessages := AArray_Of_string;
  FerrorMessages_Specified := True;
end;

function BolResult.errorMessages_Specified(Index: Integer): boolean;
begin
  Result := FerrorMessages_Specified;
end;

procedure ConsigneeResult.SeterrorMessages(Index: Integer; const AArray_Of_string: Array_Of_string);
begin
  FerrorMessages := AArray_Of_string;
  FerrorMessages_Specified := True;
end;

function ConsigneeResult.errorMessages_Specified(Index: Integer): boolean;
begin
  Result := FerrorMessages_Specified;
end;


initialization
  InvRegistry.RegisterInterface(TypeInfo(ODPickup_v2_0), 'http://odfl.com/ws/ODPickup-v2', 'UTF-8');
  InvRegistry.RegisterDefaultSOAPAction(TypeInfo(ODPickup_v2_0), '');
  InvRegistry.RegisterInvokeOptions(TypeInfo(ODPickup_v2_0), ioDocument);
  InvRegistry.RegisterInvokeOptions(TypeInfo(ODPickup_v2_0), ioLiteral);
  InvRegistry.RegisterExternalParamName(TypeInfo(ODPickup_v2_0), 'getBillOfLading', 'parameters1', 'parameters');
  RemClassRegistry.RegisterXSClass(Accessorial, 'http://odfl.com/ws/ODPickup-v2.0', 'Accessorial');
  RemClassRegistry.RegisterXSClass(Customer, 'http://odfl.com/ws/ODPickup-v2.0', 'Customer');
  RemClassRegistry.RegisterXSClass(CodDetail, 'http://odfl.com/ws/ODPickup-v2.0', 'CodDetail');
  RemClassRegistry.RegisterXSClass(ShipmentRefId, 'http://odfl.com/ws/ODPickup-v2.0', 'ShipmentRefId');
  RemClassRegistry.RegisterXSClass(Consignee, 'http://odfl.com/ws/ODPickup-v2.0', 'Consignee');
  RemClassRegistry.RegisterXSClass(Odfl4Me, 'http://odfl.com/ws/ODPickup-v2.0', 'Odfl4Me');
  RemClassRegistry.RegisterXSClass(bolResponse, 'http://odfl.com/ws/ODPickup-v2.0', 'bolResponse');
  RemClassRegistry.RegisterSerializeOptions(bolResponse, [xoLiteralParam]);
  RemClassRegistry.RegisterXSClass(bolRequest, 'http://odfl.com/ws/ODPickup-v2.0', 'bolRequest');
  RemClassRegistry.RegisterSerializeOptions(bolRequest, [xoLiteralParam]);
  RemClassRegistry.RegisterXSInfo(TypeInfo(Array_Of_Accessorial), 'http://odfl.com/ws/ODPickup-v2.0', 'Array_Of_Accessorial');
  RemClassRegistry.RegisterXSInfo(TypeInfo(Array_Of_Commodity), 'http://odfl.com/ws/ODPickup-v2.0', 'Array_Of_Commodity');
  RemClassRegistry.RegisterXSClass(BolDetail, 'http://odfl.com/ws/ODPickup-v2.0', 'BolDetail');
  RemClassRegistry.RegisterXSInfo(TypeInfo(Array_Of_ShipmentRefId), 'http://odfl.com/ws/ODPickup-v2.0', 'Array_Of_ShipmentRefId');
  RemClassRegistry.RegisterXSClass(Commodity, 'http://odfl.com/ws/ODPickup-v2.0', 'Commodity');
  RemClassRegistry.RegisterXSInfo(TypeInfo(Array_Of_string), 'http://www.w3.org/2001/XMLSchema', 'Array_Of_string');
  RemClassRegistry.RegisterXSClass(BolResult, 'http://odfl.com/ws/ODPickup-v2.0', 'BolResult');
  RemClassRegistry.RegisterXSClass(ConsigneeResult, 'http://odfl.com/ws/ODPickup-v2.0', 'ConsigneeResult');
  RemClassRegistry.RegisterXSInfo(TypeInfo(Array_Of_Consignee), 'http://odfl.com/ws/ODPickup-v2.0', 'Array_Of_Consignee');
end.

根据生成的导入单元判断,假设导入器正确完成了工作,您有责任创建和分配 vRequest.odfl4Me

vRequest.odfl4Me := Odfl4Me.Create;

您必须在分配 odfl4Me 的属性之前执行此操作。

对于其他人,我已经解决了。必须创建一个对象数组,设置长度,然后 vRequest.bolDetail.commodities = myItemArray;