- Andreas Bastian
- PowerBuilder
- Wednesday, 5 October 2022 08:38 AM UTC
Hello friends,
I'm trying to address a WEB service with an httpclient-object and the get-method, but I always get the status message 401.
I'm using the following code:
HttpClient lnv_HttpClientlnv_HttpClient = Create HttpClient
string ls_uer, ls_token, ls_string
integer li_status, li_req
ls_token = 'long_given_token_x'
lnv_HttpClient.SetRequestHeader("Host", "pp.xx.qwertz.com")
li_req = lnv_HttpClient.SetRequestHeader('qwertz-ConsumerId', ls_user)
li_req = lnv_HttpClient.SetRequestHeader('qwertz-ConsumerToken', ls_token)
li_req = lnv_HttpClient.SendRequest('GET', 'https://pp.xx.qwertz.com/pp/employeeGet')
if li_req = 1 then
li_status = lnv_HttpClient.GetResponseStatusCode()
if li_status = 200 then
lnv_HttpClient.GetResponseBody(ls_string)
end if
end if
the same procedure from the same Client-PC works fine when i'am using the extern API-Tool "Postman"
So, what i'am doing wrong?
greetings
Andreas
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.