IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage Delphi Discussion :

Databinding XML SOAP - Ne tient pas compte de IXMLCollection


Sujet :

Langage Delphi

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Janvier 2003
    Messages
    51
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Janvier 2003
    Messages : 51
    Points : 60
    Points
    60
    Par défaut Databinding XML SOAP - Ne tient pas compte de IXMLCollection
    Bonjour,

    Je dois insérer dans un TClientDataSet les data renvoyés par un web service (Serveur Ensemble - intersystem) dans un format XML SOAP (cf. PJ)

    Pour toute la partie de gestion du WSDL pas de soucis. Par contre lorsque je souhaite exploiter le XML, il ne me renvoie les sous éléments.

    Pour ce faire, j'ai utilisé le XML Data binding qui m'a généré (entre autre) les interfaces suivantes :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
     
    { IXMLDefaultDataSetType }
     
      IXMLDefaultDataSetType = interface(IXMLNodeCollection)
        ['{AD70BD6E-0331-45DF-A93D-6945F6F5D9EE}']
        { Property Accessors }
        function Get_ContainerHistory(Index: Integer): IXMLContainerHistoryType;
        { Methods & Properties }
        function Add: IXMLContainerHistoryType;
        function Insert(const Index: Integer): IXMLContainerHistoryType;
        property ContainerHistory[Index: Integer]: IXMLContainerHistoryType read Get_ContainerHistory; default;
      end;
     
    { IXMLContainerHistoryType }
     
      IXMLContainerHistoryType = interface(IXMLNode)
        ['{E76A932C-65E1-42C9-A444-072776E418D4}']
        { Property Accessors }
        function Get_MoveDate: UnicodeString;
        function Get_MT: UnicodeString;
        function Get_NbErrors: Integer;
        function Get_Container: UnicodeString;
        function Get_Description: UnicodeString;
        function Get_MoveLocation: UnicodeString;
        function Get_ACC: UnicodeString;
        function Get_AgentAlternateName: UnicodeString;
        function Get_POL: UnicodeString;
        function Get_POD: UnicodeString;
        function Get_Vessel: UnicodeString;
        function Get_Voyage: UnicodeString;
        function Get_BLNumber: UnicodeString;
        function Get_SessionTimeStamp: UnicodeString;
        function Get_MoveFileName: UnicodeString;
        function Get_ContainerId: Integer;
        function Get_DocId: Integer;
        function Get_MovementId: Integer;
        procedure Set_MoveDate(Value: UnicodeString);
        procedure Set_MT(Value: UnicodeString);
        procedure Set_NbErrors(Value: Integer);
        procedure Set_Container(Value: UnicodeString);
        procedure Set_Description(Value: UnicodeString);
        procedure Set_MoveLocation(Value: UnicodeString);
        procedure Set_ACC(Value: UnicodeString);
        procedure Set_AgentAlternateName(Value: UnicodeString);
        procedure Set_POL(Value: UnicodeString);
        procedure Set_POD(Value: UnicodeString);
        procedure Set_Vessel(Value: UnicodeString);
        procedure Set_Voyage(Value: UnicodeString);
        procedure Set_BLNumber(Value: UnicodeString);
        procedure Set_SessionTimeStamp(Value: UnicodeString);
        procedure Set_MoveFileName(Value: UnicodeString);
        procedure Set_ContainerId(Value: Integer);
        procedure Set_DocId(Value: Integer);
        procedure Set_MovementId(Value: Integer);
        { Methods & Properties }
        property MoveDate: UnicodeString read Get_MoveDate write Set_MoveDate;
        property MT: UnicodeString read Get_MT write Set_MT;
        property NbErrors: Integer read Get_NbErrors write Set_NbErrors;
        property Container: UnicodeString read Get_Container write Set_Container;
        property Description: UnicodeString read Get_Description write Set_Description;
        property MoveLocation: UnicodeString read Get_MoveLocation write Set_MoveLocation;
        property ACC: UnicodeString read Get_ACC write Set_ACC;
        property AgentAlternateName: UnicodeString read Get_AgentAlternateName write Set_AgentAlternateName;
        property POL: UnicodeString read Get_POL write Set_POL;
        property POD: UnicodeString read Get_POD write Set_POD;
        property Vessel: UnicodeString read Get_Vessel write Set_Vessel;
        property Voyage: UnicodeString read Get_Voyage write Set_Voyage;
        property BLNumber: UnicodeString read Get_BLNumber write Set_BLNumber;
        property SessionTimeStamp: UnicodeString read Get_SessionTimeStamp write Set_SessionTimeStamp;
        property MoveFileName: UnicodeString read Get_MoveFileName write Set_MoveFileName;
        property ContainerId: Integer read Get_ContainerId write Set_ContainerId;
        property DocId: Integer read Get_DocId write Set_DocId;
        property MovementId: Integer read Get_MovementId write Set_MovementId;
      end;
    Pour l'exploiter, je me suis maquetté la méthode suivante :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
     
    procedure TForm1.cxButton1Click(Sender: TObject);
    var
      Header : IXMLEnvelopeType;
      LstMvt : IXMLDefaultDataSetType;
      Mvt    : IXMLContainerHistoryType;
      I: Integer;
     
    begin
      Mo.Lines.Clear;
      Header := LoadEnvelope('C:\Temp\ContainerHistory - Copy.xml');
      if Assigned(Header) then
      begin
        LstMvt := Header.Body.GetContainerHistoryResponse.GetContainerHistoryResult.Diffgram.DefaultDataSet;
        for I := 0 to LstMvt.Count -1 do
        begin
          Mvt := LstMvt.ContainerHistory[I];
          if Assigned(Mvt) then
            Mo.Lines.Add(Mvt.MoveDate);
        end;
      end;
    end;
    Le souci est que LstMvt.Count me renvoie toujours 0 alors qu'il y a bien des éléments dans le XML.

    Les variables d'interface sont bien valorisées.
    J'ai essayé de récupérer un élément en hard codant LstMvt.ContainerHistory[0] et dans ce cas il me renvoie une erreur "Index out of bounds".

    Est-ce quelqu'un aurait une idée ?

    Merci d'avance.
    Fichiers attachés Fichiers attachés

Discussions similaires

  1. Réponses: 6
    Dernier message: 06/09/2009, 14h03
  2. [MySQL] le mot de passe ne tient pas compte des majuscules
    Par jeanfi77 dans le forum PHP & Base de données
    Réponses: 5
    Dernier message: 28/03/2007, 16h17
  3. Réponses: 9
    Dernier message: 18/03/2004, 12h20

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo