2017-03-06 146 views
-1

我想在下面的代码中设置vRequest.odfl4Me.user的值。当我运行它时,它会尝试执行该行时出现访问冲突写入错误。我认为这是因为用户是作为bolRequest对象的对象的属性。我假设我没有正确创建它。先谢谢你。Delphi 2010中的访问冲突设置Web服务元素值

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 = $0001; 
    IS_UNBD = $0002; 
    IS_NLBL = $0004; 
    IS_UNQL = $0008; 
    IS_REF = $0080; 

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. 

回答

-1

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

+0

这与问题无关,完全无法回答这个问题。我的回答是准确的。事实上,需要更多的工作来完成程序的其余工作是无关紧要的。请再次阅读该问题。它在特定的代码行询问AV。这里的文字完全没有关系。 –

0

来看由生成的进口单位,并假设进口商正确地做自己的工作,这是你的责任,创造并分配vRequest.odfl4Me

vRequest.odfl4Me := Odfl4Me.Create; 

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

+0

非常感谢!我猜,看不到树林。 –