- Laurent CRUMIERE
- PowerBuilder
- Monday, 15 May 2023 08:22 AM UTC
Hi,
I'm using a soap connection to use a webservice in PB 2021 and it works fine.
I'm trying to migrate to rest connection and get an unexpected error.
I used Postman to validate my Post arguments
Postman Headers :
Body :
When I test the request, I get an answer :
In PB 2021, I'm trying to use HTTPclient object like that :
string ls_body, ls_url, ls_ret, ls_data
httpClient lnv_HttpClient
long l_statut_reponse
integer li_rc, li_ret
ls_body = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">'+ " ~n" + &
' <soapenv:Header />'+ " ~n" + &
' <soapenv:Body>'+ " ~n" + &
' <tem:GetLogin>'+ " ~n" + &
' <tem:pLogin>borne</tem:pLogin>'+ " ~n" + &
' <tem:pPassword>bornearakis1</tem:pPassword>'+ " ~n" + &
' </tem:GetLogin>'+ " ~n" + &
' </soapenv:Body>'+ " ~n" + &
'</soapenv:Envelope>"'
ls_url = "https://portail-clients.val-solutions.fr/UegarPRESOA_EXTServer/Bornes.svc"
lnv_HttpClient = Create httpClient
// Header
lnv_HttpClient.SetRequestHeader("Content-Type", "text/xml")
lnv_HttpClient.SetRequestHeader("SoapAction", "http://tempuri.org/IBornesService/GetLogin")
lnv_HttpClient.SetRequestHeader("Host", "portail-clients.val-solutions.fr")
lnv_HttpClient.SetRequestHeader("Accept", "*/*")
lnv_HttpClient.SetRequestHeader("Accept-Encoding", "gzip, deflate, br")
lnv_HttpClient.SetRequestHeader("Connection", "keep-alive")
// Post Command
li_rc = lnv_HttpClient.sendRequest("Post", ls_url, ls_body)
// => received 1
l_statut_reponse = lnv_HttpClient.GetResponseStatusCode()
// => received 500
ls_ret = lnv_HttpClient.GetResponseStatusText()
// => received "Internal Server Error"
li_ret = lnv_HttpClient.GetResponseBody(ls_data)
I don't understand why !
Thanks in advance for your help !
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.