PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Can;t connect to web service from Windev
Can;t connect to web service from Windev
Débuté par steve erts, 24 aoû. 2018 03:07 - 5 réponses
Posté le 24 août 2018 - 03:07
Hi,

I've written a rest web service in windev 22 and have it installed and working on a clients server (server A). I've now installed it on second server (server B) and am having some issues calling Server B it from my windev 22 desktop app.

When I do make a call I get "No server response. Check whether a HTPP server is present on the target server".

Oddly, I can successfully call the web service on Server B from webdev's browser based test tool and from browser code of a webdev AWP page, but NOT from the server code of same webdev page.

I am stumped. Here is code. Any ideas?

If any ones to try hitting below from Windev desktop feel free. That might at least rule out network related issues.

Thanks!

sURL is string
sURL="https://rds.tourcube.net/tourcube/ping"

sHTTPRequest is httpRequest
sHTTPRequest..Header["tc-api-key"] = "MTSTEST"
sHTTPRequest..URL=sURL
sHTTPRequest..Method=httpGet
cMyResponse is httpResponse = HTTPSend(sHTTPRequest)
IF ErrorOccurred THEN
Error(ErrorInfo(errFullDetails))
ELSE
Info(cMyResponse..Content)
END
Posté le 24 août 2018 - 03:18
I get "access denied" when I copy/paste https://rds.tourcube.net/tourcube/ping into the address bar of a Firefox tab.
Posté le 24 août 2018 - 03:25
That’s intentional.

There are headers required
Posté le 24 août 2018 - 08:27
It looks like for some reason the server does not like the request as it's being sent by

sURL is string
sURL="https://rds.tourcube.net/tourcube/ping"
sHTTPRequest is httpRequest
sHTTPRequest..Header["tc-api-key"] = "MTSTEST"
sHTTPRequest..URL=sURL
sHTTPRequest..Method=httpGet
cMyResponse is httpResponse = HTTPSend(sHTTPRequest)


IF ErrorOccurred THEN
Error(ErrorInfo)
ELSE
Info(cMyResponse..Content)
END



b./c when I sent in the following manner it works

HTTPRequest("https://rds.tourcube.net/tourcube/ping","","tc-api-key: MTSTEST","","","","")
ResCode is string = HTTPGetResult()
Info(ResCode)


Does anyone have any ideas?
Posté le 24 août 2018 - 18:25
The plot thickens..

I trapped my requests in Ngrok

This request from Fiddler works

GET / HTTP/1.1
tc-api-key: MTSTEST
User-Agent: Fiddler
Host: https://rds.tourcube.net/tourcube/ping
X-Forwarded-For: 97.115.112.236

but this one from Windev does not

GET / HTTP/1.1
Host: e0da3aa0.ngrok.io
User-Agent: Tourcube
Accept: */*
Connection: close
tc-api-key: MTSTEST
X-Forwarded-For: 97.115.112.236

maybe something about "Accept" and "Connection" that Server B does not like. Oddly my HTPP Response Headers in IIS are same on both servers.
Posté le 24 août 2018 - 20:33
The second server was kind of old and did not support TLS 1.2

when I added sHTTPRequest..VersionSSL=ProtocolTLS1 it fixed issue.

Now to get that server upgraded