FORUMS PROFESSIONNELS
WINDEV
,
WEBDEV
et
WINDEV Mobile
Accueil
|
Messages récents
|
Connexion
|
Déconnexion
|
Français
Accueil
→
WINDEV 2024
→
soap call to a external webservice including header
soap call to a external webservice including header
Débuté par Gustavo Gonzalez, 16 mar. 2018 20:26 - 2 réponses
Connectez-vous…
Gustavo Gonzalez
#1
Posté le 16 mars 2018 - 20:26
Hello I wanted to see if someone can help me with the necessary syntax in WINDEV to call a webservice including data that is passed as part of the header ...
The first thing I did was to try it in the most standard way possible and for that I used the SOAPUI program
https://www.soapui.org/
In that program I address the direction of Webserice to:
https://hdi.com.uy/hdi/ExternalQuotation/ExternalQuotationMethods.svc
then the request and it works perfectly
<
soapenv
:
Envelope
xmlns
:
ext
=
"http://schemas.datacontract.org/2004/07/ExternalQuotation.Model.Data"
xmlns
:
soapenv
=
"http://schemas.xmlsoap.org/soap/envelope/"
xmlns
:
tem
=
"http://tempuri.org/"
>
<
soapenv
:
Header
>
<
wsse
:
Security
xmlns
:
wsse
=
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns
:
wsu
=
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
soapenv
:
mustUnderstand
=
"1"
>
<
wsse
:
UsernameToken
wsu
:
Id
=
""
>
<
wsse
:
Username
>
XXX
<
/
wsse
:
Username
>
<
wsse
:
Password
Type
=
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"
>
XXX
<
/
wsse
:
Password
>
<
wsse
:
Nonce
EncodingType
=
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"
>
<
/
wsse
:
Nonce
>
<
wsu
:
Created
>
2017-12-21T14:48:01.646Z
<
/
wsu
:
Created
>
<
/
wsse
:
UsernameToken
>
<
/
wsse
:
Security
>
<
/
soapenv
:
Header
>
<
soapenv
:
Body
>
<
tem
:
GetAgentDataDTOList
>
<
tem
:
filter
>
<
ext
:
PageNumber
>
1
<
/
ext
:
PageNumber
>
<
ext
:
PageSize
>
50
<
/
ext
:
PageSize
>
<
/
tem
:
filter
>
<
/
tem
:
GetAgentDataDTOList
>
<
/
soapenv
:
Body
>
<
/
soapenv
:
Envelope
>
but if I try to do it from WINDEV it does not work for me, it returns false ...
sMensajeXML is string = [
<
soapenv
:
Envelope
xmlns
:
ext
=
"http://schemas.datacontract.org/2004/07/ExternalQuotation.Model.Data"
xmlns
:
soapenv
=
"http://schemas.xmlsoap.org/soap/envelope/"
xmlns
:
tem
=
"http://tempuri.org/"
>
<
soapenv
:
Header
>
<
wsse
:
Security
xmlns
:
wsse
=
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns
:
wsu
=
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
soapenv
:
mustUnderstand
=
"1"
>
<
wsse
:
UsernameToken
wsu
:
Id
=
""
>
<
wsse
:
Username
>
XUSUARIOX
<
/
wsse
:
Username
>
<
wsse
:
Password
Type
=
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"
>
XCLAVEX
<
/
wsse
:
Password
>
<
wsse
:
Nonce
EncodingType
=
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"
>
<
/
wsse
:
Nonce
>
<
wsu
:
Created
>
2017-12-21T14:48:01.646Z
<
/
wsu
:
Created
>
<
/
wsse
:
UsernameToken
>
<
/
wsse
:
Security
>
<
/
soapenv
:
Header
>
<
soapenv
:
Body
>
<
tem
:
GetAgentDataDTOList
>
<
tem
:
filter
>
<
ext
:
PageNumber
>
1
<
/
ext
:
PageNumber
>
<
ext
:
PageSize
>
50
<
/
ext
:
PageSize
>
<
/
tem
:
filter
>
<
/
tem
:
GetAgentDataDTOList
>
<
/
soapenv
:
Body
>
<
/
soapenv
:
Envelope
>
]
b
Resultado
is boolean
=
SOAPRunXML
(
"https://hdi.com.uy/hdi/ExternalQuotation/ExternalQuotationMethods.svc"
,
s
MensajeXML
)
Info
(
b
Resultado
)
//Return: false
Info
(
ErrorInfo
)
////Return: Security Alert: name on security is incorrect or does not match the selected site.
Did something similar happen to someone?
Any idea what would be the correct way to write this in WLANGUAJE?
Signaler
0
0
José BRANDÃO
#2
Membre enregistré
16 messages
Posté le 19 mars 2018 - 15:17
Try using the created structures of the imported webservice
i once had to call a webservice with header and it ended up like this:
Header is string=''''
Header+="<soapenv:Header>"
Header+="<wsse:Security soapenv:mustUnderstand=""1"" xmlns:wsse=""
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd
"" xmlns:wsu=""
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd
"">"
Header+="<wsse:UsernameToken wsu:Id=""UsernameToken-730C01D84F852BD37A15093785037226"">"
Header+="<wsse:Username>%1</wsse:Username>"
Header+="<wsse:Password Type=""
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0…
"">%2</wsse:Password>"
Header+="</wsse:UsernameToken>"
Header+="</wsse:Security>"
Header+="</soapenv:Header>"
EndPointWS
is string
=
"https://qualsiliamb.apambiente.pt/egar/services/GuiaAcompanhamentoWs/v2"
s
Token
is string
=
"XXXXXXXXXXXXXXXXXXX"
s
Password
is string
s
Password
=
E
DT_Password
C
onsultaTransp
is
consultaDadosTransportadorInput
C
onsultaTransp.nif
=
E
DT_Contribuinte
C
onsultaTransp.tokenCertificacao
=
s
Token
XmlString
is string
XmlString
=
SOAPPrepare
(
consultaDadosTransportador
,
C
onsultaTransp
)
XmlString
=
Replace
(
XmlString
,
"<SOAP-ENV:Header/>"
,
StringBuild
(
Header
,
E
DT_Contribuinte
,
s
Password
)
,
IgnoreCase
)
XmlString
=
Replace
(
XmlString
,
"SOAP-ENV"
,
"soapenv"
,
IgnoreCase
)
b
Resposta
is boolean
b
Resposta
=
SOAPRunXML
(
EndPointWS
,
XmlString
,
""
)
IF
b
Resposta
=
False
THEN
Error
(
SOAPError
(
SOAPErrMessage
)
)
RETURN
END
s
Resposta
is string
s
Resposta
=
'
'
<
?
xml version
=
'
'
'
'
1.0
'
'
'
'
encoding
=
'
'
'
'
ISO
-
8859
-
1
'
'
'
'
?
>
'
'
+
SOAPGetResult
(
SOAPXMLResult
)
Resultado
is xmlDocument
Resultado
=
XMLOpen
(
s
Resposta
,
fromString
)
consultaDadosTransportadorInput is what windev imported from the webservice and consultaDadosTransportador is the function
Note: i replaced " with '' in sResposta
Signaler
0
0
Roberto O.
#3
Posté le 15 décembre 2021 - 20:25
Hallo Gustavo, you had found a solution to this problem. I have a similar problem too. Thx
Signaler
0
0
→ Revenir à WINDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (précédentes versions)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Type de recherche
Uniquement les sujets
Tous les messages
Période de recherche
Date indifférente
Moins d'une heure
Moins de 24 heures
Moins d'une semaine
Moins d'un mois
Moins d'un an
Annuler
Aperçu de votre message
Ajouter une image
Importer une image depuis une URL
Envoyer une image depuis un fichier de votre disque
Déposez ici un fichier ou cliquez sur "Parcourir..."
ou
Annuler
0%
WLangage
SQL
XML, HTML
JAVA, Javascript
Texte