PROFESSIONAL NEWSGROUPS
WINDEV
,
WEBDEV
and
WINDEV Mobile
Home
|
Recent messages
|
Connect
|
Sign out
|
English
Home
→
WINDEV (earlier versions)
→
WD20 Erreur RestEnvoie / RestReponse
WD20 Erreur RestEnvoie / RestReponse
Started by bemous, Apr., 05 2019 9:01 PM - 3 replies
Connect yourself…
bemous
#1
Posted on April, 05 2019 - 9:01 PM
Bonjour à tous,
j'ai un problème avec l'envoie d'un enregistrement en JSON par webservice. Le fournisseur m'a donnée un token d'authentification. Un code vaut mieux que mille mots:
Procedure
EnvoieClientAuServeurEnLigne
(
UnClient
)
buf
NewClient
est une
Buffer
v
AlClient
est un
Variant
wsRequête est une restRequête
mReponse
est une restRéponse
valClient.Raison_Soc
=
UnClient
buf
NewClient
=
VariantVersJSON
(
v
AlClient
)
wsRequête
.
URL
=
"...../api/clients"
wsRequête
.
Méthode
=
httpPost
wsRequête
.
ContentType
=
"application/json"
wsRequête
.
Entête
[
"AuthToken"
]
=
api_token
wsRequête
.
Contenu
=
buf
NewClient
mReponse
=
RESTEnvoie
(
wsRequête
)
SI
ErreurDétectée
ALORS
Erreur
(
ErreurInfo
(
errComplet
)
)
SINON
Info
(
mReponse.Contenu
)
FIN
Une fois exécuté j'ai alors en retour:
<
!
DOCTYPE html
>
<
html
>
<
head
>
<
meta charset
=
"UTF-8"
/
>
<
meta http
-
equiv
=
"refresh"
content
=
"0;url=urlFournisseur:8010/login"
/
>
<
title
>
Redirecting to urlFournisseur/login
<
/
title
>
<
/
head
>
<
body
>
Redirecting to
<
a href
=
"urlFournisseur/login"
>
urlFournisseur:8010/login
<
/a>
.
<
/
body
>
<
/
html
>
Je veux bien comprendre
Merci d'avance
Report
0
0
bemous
#2
Posted on April, 08 2019 - 1:27 PM
Toujours pas de réponses?
Report
0
0
bemous
#3
Posted on April, 19 2019 - 2:30 PM
besoins d'aide personne n'a de réponses?
Report
0
0
Pierre
#4
Posted on May, 17 2019 - 1:37 PM
Bonjour,
j'ai rencontré aussi le même genre de soucis est j'ai résolu cela en remplaçant les guillemets du contenu par une simple côte.
temp = VariantVersJSON(listObjects)
temp2 est une chaîne = Remplace(temp, Caract(34), Caract(39))
cRequete.Contenu = ChaîneVersUTF8(temp2)
J'espère que cela pourra vous débloquer.
Report
0
0
→ Go back to WINDEV (earlier versions)
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (earlier versions)
WEBDEV (earlier versions)
WINDEV Mobile (earlier versions)
Reports & Queries
Off-topic
Tools
Français
English
Español
Portuguesa
Close this window
Search type
Only topics
All the messages
Search period
Any time
Past hour
Past 24 hours
Past week
Past month
Past year
Cancel
Preview of your message
Adding an image
Import an image from a URL
Send an image from a file of your disk
Drop a file or click "Browse..."
or
Cancel
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Text