Thema: Delphi DPD Webservice

Einzelnen Beitrag anzeigen

horstmeyer

Registriert seit: 9. Aug 2021
46 Beiträge
 
#1

DPD Webservice

  Alt 3. Aug 2023, 14:45
Hallo Leute,

hat jemand schon mal mit DPD Webservice gearbeitet? Ich versuche gerade das Java-Beispiel nach Delphi zu konvertieren, komme aber leider nicht klar.

Das Beispiel in Java:
Code:
      // printOptions   
      PrintOption[] myPrintOptionList = new PrintOption[1];
      PrintOption myPrintOption = new PrintOption();   
      myPrintOption.setPaperFormat(com.dpd.common.service.types.ShipmentService._4_4.PrintOptionPaperFormat.A4);
      myPrintOption.setStartPosition(com.dpd.common.service.types.ShipmentService._4_4.StartPosition.UPPER_LEFT);
      myPrintOption.setOutputFormat(com.dpd.common.service.types.ShipmentService._4_4.OutputFormatType.PDF);
      myPrintOptionList[0] = myPrintOption;
Ich habe es mal so versucht, die Zuweisung funktioniert aber nicht:
Code:
procedure TForm1.MLButton2Click(Sender: TObject);
var
  ret : storeOrdersResponseType;
  myShipmentService44Client : ShipmentService_4_4;
  apiAuth : authentication;
  myPrintOptionList : array of PrintOption;
  myPrintOption : PrintOption;
begin

  if myAuthToken.Length>0 then begin
    showmessage('StoreOrders'+chr(13)+
                'delisId:'+mylogin.delisId+chr(13)+
                'customerUid:'+mylogin.customerUid+chr(13)+
                'authToken:'+myAuthToken+chr(13)+
                'depot:'+mylogin.depot+chr(13)+
                'System:'+sSystem);

    with apiAuth do begin
      delisId:=EditLogin.Text;
      authToken := myAuthToken;
      messageLanguage := 'de_DE';
    end;

    try

    myPrintOption.paperFormat:=printOption.PaperFormat.A4;
      // printOptions
//      PrintOption[] myPrintOptionList = new PrintOption[1];
//      PrintOption myPrintOption = new PrintOption();
//      myPrintOption.setPaperFormat(com.dpd.common.service.types.ShipmentService._4_4.PrintOptionPaperFormat.A4);
//      myPrintOption.setStartPosition(com.dpd.common.service.types.ShipmentService._4_4.StartPosition.UPPER_LEFT);
//      myPrintOption.setOutputFormat(com.dpd.common.service.types.ShipmentService._4_4.OutputFormatType.PDF);
//      myPrintOptionList[0] = myPrintOption;

      showmessage('storeorder');
    except
      showmessage('Fehler');
    end;
  end else begin
    showmessage('Bitte erst anmelden.');
  end;

end;
Hier der Ausschnitt der Klasse PrintOption:
Code:
  // ************************************************************************ //
  // XML      : printOption, global, <complexType>
  // Namespace : http://dpd.com/common/service/types/ShipmentService/4.4
  // ************************************************************************ //
  printOption = class(TRemotable)
  private
    FoutputFormat: OutputFormatType;
    FpaperFormat: paperFormat;
    FpaperFormat_Specified: boolean;
    Fprinter: printer;
    Fprinter_Specified: boolean;
    FstartPosition: startPosition;
    FstartPosition_Specified: boolean;
    procedure SetpaperFormat(Index: Integer; const ApaperFormat: paperFormat);
    function paperFormat_Specified(Index: Integer): boolean;
    procedure Setprinter(Index: Integer; const Aprinter: printer);
    function printer_Specified(Index: Integer): boolean;
    procedure SetstartPosition(Index: Integer; const AstartPosition: startPosition);
    function startPosition_Specified(Index: Integer): boolean;
  public
    destructor Destroy; override;
  published
    property outputFormat: OutputFormatType Index (IS_UNQL) read FoutputFormat write FoutputFormat;
    property paperFormat:  paperFormat      Index (IS_OPTN or IS_UNQL) read FpaperFormat write SetpaperFormat stored paperFormat_Specified;
    property printer:      printer          Index (IS_OPTN or IS_UNQL) read Fprinter write Setprinter stored printer_Specified;
    property startPosition: startPosition    Index (IS_OPTN or IS_UNQL) read FstartPosition write SetstartPosition stored startPosition_Specified;
  end;
  Mit Zitat antworten Zitat