PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → SoapAddHeader for Webservice
SoapAddHeader for Webservice
Iniciado por guest, 20,feb. 2014 13:49 - 10 respuestas
Publicado el 20,febrero 2014 - 13:49
Hello,

I have a problem with Windev 18. I have imported a webservice what works verry easy, but to send a message to the webservice i have to add a security header with the user name and a password. Below you see the soap header i have to send, but how is it possible to send it to the imported webservice? I used SoapAddHeader but I think I do something wrong.

Thank you..

<SOAP-ENV: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">
<wsse:UsernameToken
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:Username>USERNAME</wsse:Username>
<wsse:Password
Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0…">PASSWORD</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</SOAP-ENV:Header>
Publicado el 20,febrero 2014 - 19:51
Hi Sammy,

I've been chewing on this as well and had a support request without any reply since it is "external to wd". (By definition a web service can be external, no)

Although typically this kind of authenticated web services is implemented in many web service based systems on weblogic (formerly known as bea) and oracle enterprise application software...

There are several similar threads in the French forum on the same subject without a solution out of the box (but interesting to read):
WD Forum

Cheers,

Peter H.
Publicado el 24,febrero 2014 - 22:37
Thank you for the response Peter!
But i can't find the good answere. When i use soaprunxml with the complete soap message in à txt file it doesn't work. Is this à windev problem?
Publicado el 25,febrero 2014 - 18:41
Hi Sammy,

Not sure this will help but I had a similar issue a few years ago calling a webservice though SoapRunXML. The solution I came up with was sort of a hack but worked. What I did was manually build the xml that I sent across.

Here is a sample of how I did it. // note: I used } and { instead of > and < so the content would show.


sVDQ is string
sVDQ =Charact(34) /// this is = "

sXml_message is string
sXml_message="{SOAP-ENV:Envelope xmlns:SOAP-ENV="+sVDQ+"http://schemas.xmlsoap.org/soap/envelope/"+sVDQ+CR+
" xmlns:SOAP-ENC="+sVDQ+"http://schemas.xmlsoap.org/soap/encoding/"+sVDQ+CR+
" xmlns:xsi="+sVDQ+"http://www.w3.org/2001/XMLSchema-instance" +sVDQ+CR+
" xmlns:xsd="+sVDQ+"http://www.w3.org/2001/XMLSchema"+sVDQ+"}"+CR+
"{SOAP-ENV:Body}"+CR+
"{<m:authenticate xmlns:m="+sVDQ+"http://com.gblmatrix.WS.WebBooking/samples/WebBookingInterface/types"+sVDQ+"}"+CR+
"{username}"+Global_Matrix_Configuration.User_Name+"{/username}"+CR+
"{password}"+Global_Matrix_Configuration.Password+"{/password}"+CR+
"{/m:authenticate}"+CR+
"{/SOAP-ENV:Body}"+CR+
"{/SOAP-ENV:Envelope}"
Publicado el 25,febrero 2014 - 20:32
Steve,

I tried you way but it dosn't work. When i put the xml message into windev on your way but its not working, i wil get errors all the time.

Below a sample what i try to do, i put the xml message into a txt file. But this is also not working.


Gelukt is boolean
Bericht is string = fLoadText("c:\SimpelGarage\OKRvraagRDC.txt")


Info(bericht)


Gelukt = SOAPRunXML("https://acc-rdwservices.rdc.nl/okr/3.0/acc","bericht")
Info(Gelukt)
// Is the communication with the server successful?
IF Gelukt = True THEN
// Is the procedure successfully run?
IF SOAPGetResult(SOAPHTTPResult) <> "" THEN
// Display the result returned by the procedure
Info(SOAPGetResult(SOAPHTTPResult))
ELSE
// Display the error returned by the SOAP server
Error(SOAPError(SOAPErrMessage))
END
ELSE
Error(ErrorInfo(errMessage))
END
Publicado el 25,febrero 2014 - 21:15
Hi Sammy,

My guess is your XML still misses some info or is not 100% formatted properly.
I would use SoapUI first (free download) to check wether your XML is OK.
This tool gives much much more info about webservices, the call to a webservice, generates test messages and so on.

Then SoapRunXML should work. I use it in one of my projects as well.
Publicado el 25,febrero 2014 - 21:23
Arie,

I have checked the xml message with SoapUI and that works fine. I have made another webservice on exact the same way and that works fine.
Publicado el 27,febrero 2014 - 20:37
I use the code below, but i dont now of the soapaddheader is on the correct way. It is the header from the soap message at the begin of this question. Anyone who can help me?

kmstand is a registrerenTellerstandVraag
response is a registrerenTellerstandAntwoord


SOAPAddHeader("UsernameToken","rdcxxxxxx999","http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd",True)
SOAPAddHeader("Password","xxxxxxxx","http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd",True)

kmstand.aanvragenEpas = "false"
kmstand.bron = "ROB"
kmstand.epasEmailadres = "info@sabrosoft.nl"
//kmstand.GeenTeller = ""
kmstand.kenteken = "93vrdc"
kmstand.rdwBedrijfsnummer = "73116"
kmstand.tellerstand:eenheid = "Kilometer"
kmstand.tellerstand = "125658"



Info(OkrService.registrerenTellerstand(kmstand))

response = OkrService.registrerenTellerstand(kmstand)
Info(response.rdwMelding,response.registratiedatumtijd)
Publicado el 28,febrero 2014 - 16:22
Hi,

This works for me : first build the xml without a header, and than replace the empty header with the security header



Best regards,
Bart
Publicado el 01,marzo 2014 - 12:03
I tried your way but i get the next error. Do you now what i`m doing wrong?




[attachment 840 windev2.JPG]
[attachment 841 windev1.JPG]
[attachment 842 windev3.JPG]
Publicado el 31,marzo 2020 - 16:57
Hey Sammy,

Ben je er ooit uit geraakt ?
Wij hebben een gelijkaardig probleem om een webservice van de sociale zekerheid aan te spreken vanuit Windev.

Mvg,
Ann.