Parser une réponse SOAP complexe
salut pour tous
j'ai fait l'appel d'un web service WCF sous android,la fonction que j'ai appelé retourne un objet "personnel", j'ai obtenu la reponse soap suivant :
Code:
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
|
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<GetPersonnelByPasswordResponse xmlns="http://mycompany.com/PersonnelService">
<GetPersonnelByPasswordResult z:Id="i1" xmlns:a="http://schemas.datacontract.org/2004/07/DataAccessLayer.Modele" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/">
<EntityKey z:Id="i2" xmlns="http://schemas.datacontract.org/2004/07/System.Data.Objects.DataClasses" xmlns:b="http://schemas.datacontract.org/2004/07/System.Data">
<b:EntityContainerName>DSS_SOTUBIEntities</b:EntityContainerName>
<b:EntityKeyValues>
<b:EntityKeyMember>
<b:Key>PersonnelID</b:Key>
<b:Value i:type="c:long" xmlns:c="http://www.w3.org/2001/XMLSchema">2</b:Value>
</b:EntityKeyMember>
</b:EntityKeyValues>
<b:EntitySetName>Personnels</b:EntitySetName>
</EntityKey>
<a:Adresse>ariana</a:Adresse>
<a:Email>zied@hotmail.fr</a:Email>
<a:Login>admin</a:Login>
<a:Matricule>1</a:Matricule>
<a:Nom>ben mahmoud</a:Nom>
<a:Password>admin</a:Password>
<a:PersonnelID>2</a:PersonnelID>
<a:Prenom>zied</a:Prenom>
<a:ProfilID>1</a:ProfilID>
<a:Tel>123</a:Tel>
</GetPersonnelByPasswordResult>
</GetPersonnelByPasswordResponse>
</s:Body>
</s:Envelope> |
le code java que j'ai utilisé:
Code:
1 2 3 4 5 6 7 8 9 10
|
try {
androidHttpTransport.call(SOAP_ACTION + GetPersonnel_METHOD, envelope);
SoapObject result = (SoapObject)envelope.getResponse();
Log.d("personnel : ", result.toString());
return result.toString(); |
je veux parser cette resultat "result" (un objet complexe) a la forme d'une classe prédifinit personnelDTO
Code:
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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
public class PersonnelDTO {
public long PersonnelID ;
public void setPersonnelID(Long personnelID) {
this.PersonnelID = personnelID;
}
public long getPersonnelID() {
return PersonnelID;
}
public String Login ;
public void setLogin(String login) {
this.Login = login;
}
public String getLogin() {
return Login;
}
public String Password ;
public void setPassword(String password) {
this.Password = password;
}
public String getPassword() {
return Password;
}
public Integer ProfilID ;
public void setProfilID (Integer profilID)
{
this.ProfilID = profilID ;
}
public Integer getProfilID (){
return ProfilID;
}
public String Nom ;
public void setNom (String nom){
this.Nom = nom;
}
public String getNom(){
return Nom;
}
public String Prenom ;
public void setPrenom (String prenom){
this.Prenom = prenom;
}
public String getPrenom(){
return Prenom;
}
public Integer Tel ;
public void setTel(Integer tel){
this.Tel = tel;
}
public Integer getTel(){
return Tel;
}
public String Email ;
public void setEmail (String email){
this.Email = email;
}
public String getEmail(){
return Email;
}
public String Adresse ;
public void setAdresse(String adresse)
{
this.Adresse = adresse;
}
public String getAdresse(){
return Adresse;
}
public Integer Matricule ;
public void setMatricule (Integer matricule){
this.Matricule = matricule;
}
public Integer getMatricule (){
return Matricule;
}
} |
j'ai essayé avec plusieurs, mais jamais j'ai trouvé une solution a ce problème.
y a t'il une quelqu'un peut m'aider SVP et merci d'avance.