PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2025 → webservice rest
webservice rest
Iniciado por ylmeti, 13,ago. 2019 16:40 - 2 respuestas
Miembro registrado
9 mensajes
Publicado el 13,agosto 2019 - 16:40
Bonjour,

Je dois contacter un webservice réalisé par un autre service de ma boite. Celui-ci comprend des entêtes à intégrer pour authentification et est accessible en https.

Via chrome et edge, l'url me renvoit un certficat invalide et si je poursuis quand même j'obtiens une réponse json du genre

{
code: "CONSTRAINT VALIDATION_ERROR",
message: "erreur de validation des paramètres",
errors: [
{
nomParam: "getRessource.arg2",
codeError: "NotNullValidator",
message: "value '' : may not be null"
},
{
nomParam: "getRessource.arg1",
codeError: "NotNullValidator",
message: "value '' : may not be null"
},
{
nomParam: "getRessource.arg0",
codeError: "NotNullValidator",
message: "value '' : may not be null"
}
]
}

ce qui est normal, je n'ai pas placé d'entête.
Si je fais la même manipulation sous internet explorer j'obtiens un résultat différent, j'ai l'alerte de cetificat invalide et si je poursuis j'obtiens un beau erreur 400 page web introuvable.
Avec mon programme windev 22, j'ai l'impression que je tombe sur le même résultat (utilisation des bibliothèques internet explorer?), j'obtiens systématiquement un code retour 0 ce qui correspondrait à une inaccessibilité au site, que je lance une commande de paramétrage de proxy ou non (ligne en commentaire dans le code) :

MarequeteREST est un restRequête
MaReponseREST est un restRéponse
RequeteParametree est une chaîne = adresseWbs + complementURL + "%1"
ContenuReponse est une chaîne
MarequeteREST.Méthode = httpGet
//MarequeteREST.VersionSSL = ProtocoleTLS1
MarequeteREST.TimeOutConnexion = timeOut
MarequeteREST.DuréeNonRéponse = timeOut
MarequeteREST..Header["x-site"] = "SITE"
MarequeteREST..Header["x-dossier"] = "DOSSITE"
MarequeteREST..Header["x-magasin"] = "12"
MarequeteREST..Header["x-utilisateur"] = "oneuser"
MarequeteREST..Header["Accept-Language"] = "FR"
MarequeteREST..Header["Accept"] = "application/json"
MarequeteREST..IgnoreErreur = httpIgnoreCertificatInvalide+httpIgnoreCertificatExpiré+httpIgnoreNomCertificatInvalide+httpIgnoreRenvoiHTTP+httpIgnoreRenvoiHTTPS+httpIgnoreRedirection

MarequeteREST.URL = RequeteParametree
TracerDebug("Appel du webservice " + RequeteParametree)
//Proxy("xxx.xxx.xxx.xxx", 80, "login", "mdp")
MaReponseREST = RESTEnvoie(MarequeteREST)
SELON MaReponseREST..CodeEtat
CAS 200, 201, 206 :
SI ErreurDétectée ALORS

SINON
ContenuReponse = MaReponseREST.Contenu
RENVOYER ContenuReponse
FIN
RENVOYER ""
CAS 202 :
ContenuReponse = MaReponseREST.Contenu
RENVOYER ContenuReponse
CAS 204 :
RENVOYER MaReponseREST..CodeEtat + RC + MaReponseREST..DescriptionCodeEtat
CAS 301 :
RENVOYER MaReponseREST..CodeEtat + RC + MaReponseREST..DescriptionCodeEtat
CAS 302 :
RENVOYER MaReponseREST..CodeEtat + RC + MaReponseREST..DescriptionCodeEtat
CAS 400 :
RENVOYER MaReponseREST..CodeEtat + RC + MaReponseREST..DescriptionCodeEtat
CAS 401 :
RENVOYER MaReponseREST..CodeEtat + RC + MaReponseREST..DescriptionCodeEtat
CAS 403 :
RENVOYER MaReponseREST..CodeEtat + RC + MaReponseREST..DescriptionCodeEtat
CAS 404 :
RENVOYER MaReponseREST..CodeEtat + RC + MaReponseREST..DescriptionCodeEtat
CAS 405 :
RENVOYER MaReponseREST..CodeEtat + RC + MaReponseREST..DescriptionCodeEtat
CAS 406 :
RENVOYER MaReponseREST..CodeEtat + RC + MaReponseREST..DescriptionCodeEtat
CAS 500 :
RENVOYER MaReponseREST..CodeEtat + RC + MaReponseREST..DescriptionCodeEtat
CAS 503 :
RENVOYER MaReponseREST..CodeEtat + RC + MaReponseREST..DescriptionCodeEtat
AUTRE CAS
RENVOYER MaReponseREST..CodeEtat + RC + MaReponseREST..DescriptionCodeEtat
FIN


Quelqu'un aurait une idée?
Merci.
Miembro registrado
1.330 mensajes
Publicado el 13,agosto 2019 - 19:54
Salut ylmeti,

Je sais que ça ne va pas t'aider, mais ça ne serait pas plus simple de voir directement avec le service de ta boîte ?
Je pense qu'ils sont les mieux placés pour t'aider, non ?

A+
Daryl

--
http://www.concept4u2.com
Miembro registrado
9 mensajes
Publicado el 14,agosto 2019 - 11:16
Salut, merci pour la réponse mais j'ai trouvé.
C'est pas en rapport avec le webservice ni internet explorer, c'est juste le timeout qui provoque un retour 0 avec "erreur système rencontrée" au lieu d'obtenir un retour explicite.

C'est pas très bien foutu mais j'ai résolu mon problème.