PROFESSIONAL NEWSGROUPS
WINDEV
,
WEBDEV
and
WINDEV Mobile
Home
|
Recent messages
|
Connect
|
Sign out
|
English
Home
→
WINDEV 25
→
Webservice Soap com Autenticação no cabeçalho/Header
Webservice Soap com Autenticação no cabeçalho/Header
Started by Boller, Jun., 28 2020 1:44 PM - No answer
Connect yourself…
Boller
#1
Registered member
3,651 messages
Popularité : +175 (223 votes)
Posted on June, 28 2020 - 1:44 PM
Bom dia
Segue abaixo o exemplo
Les requêtes aux WebServices
sont
envoyées au serveur Web enveloppées
DANS un Document
xml
.
Pour certains WebServices l
’
authentification
est
faite grâce
un
entête à ajouter au
Document
xml
.
Prenons
par
exemple
un
WebService qui nécessite ce type d
’
authentification
:
<
soapenv
:
Envelope xmlns
:
xsi
=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns
:
xsd
=
"http://www.w3.org/2001/XMLSchema"
xmlns
:
soapenv
=
"http://schemas.xmlsoap.org/soap/envelope/"
xmlns
:
net
=
"http://www.WS.TEST/TestST"
>
<
soapenv
:
Header
>
<
WebServiceLogin xsi
:
type
=
"net:WebServiceLogin"
>
<
RefClient xsi
:
type
=
"xsd:int"
>
?
<
/
refClient
>
<
NomUser xsi
:
type
=
"xsd:string"
>
?
<
/
NomUser
>
<
MotPasse xsi
:
type
=
"xsd:string"
>
?
<
/
MotPasse
>
<
/
WebServiceUser
>
<
/
soapenv
:
Header
>
<
soapenv
:
Body
>
<
net
:
getListeCommandes soapenv
:
encodingStyle
=
"http://schemas.xmlsoap.org/soap/encoding/"
>
<
dateDeb xsi
:
type
=
"xsd:string"
>
?
<
/
dateDeb
>
<
dateFin xsi
:
type
=
"xsd:string"
>
?
<
/
dateFin
>
<
/
net
:
getListeCommandes
>
<
/
soapenv
:
Body
>
<
/
soapenv
:
Envelope
>
On voit
DANS une
requête type
,
la partie concernant l
’
enveloppe
,
une
partie
«
Header
»
AVEC
l
’
authentification
ET une
partie
«
Body
»
AVEC
l
’
appel du WebService
.
une
fois importé
DANS
WINDEV
,
le WebService va exposer la
Procedure
getListeCommandes qui attend deux paramètres
(
une
date
de
début
ET une
date
de FIN
)
ET une structure
WebServiceLogin
.
DANS
ce WebService
,
il faut donc ajouter lors
de
l
’
authentification la référence client
,
le nom
de
l
’
utilisateur
ET
le mot
de
passe
DANS
l
’
entête du
Document
xml
.
On
Utilise
pour cela la
FONCTION
SOAPAjouteEntête
(
)
en déclarant
une Variable de
ce type
:
LoginWs
est un
WebServiceLogin
LoginWs.RefClient
=
"9811X1255"
LoginWs.NomUser
=
"adresse.complement@domaine.fr"
LoginWs.MotPasse
=
"MotPasse"
SOAPAjouteEntête
(
TestST
,
LoginWs
)
Vous pouvez ensuite appeler directement la
FONCTION
du WebService souhaitée
:
wsResponse
=
TestST.GetListeCommandes
(
"20190114"
,
"20200414"
)
--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/
Report
0
0
→ Go back to WINDEV 25
WINDEV 25
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